Last active
March 18, 2019 08:16
-
-
Save thinca/36897fa4e0df40aaf3bd7c35ff59091b to your computer and use it in GitHub Desktop.
テキストプロパティで落ちるやつ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/textprop.c b/src/textprop.c | |
index 674faebe2..00436f51a 100644 | |
--- a/src/textprop.c | |
+++ b/src/textprop.c | |
@@ -629,7 +629,7 @@ f_prop_remove(typval_T *argvars, typval_T *rettv) | |
mch_memmove(newptr, buf->b_ml.ml_line_ptr, | |
buf->b_ml.ml_line_len); | |
buf->b_ml.ml_line_ptr = newptr; | |
- curbuf->b_ml.ml_flags |= ML_LINE_DIRTY; | |
+ buf->b_ml.ml_flags |= ML_LINE_DIRTY; | |
} | |
taillen = buf->b_ml.ml_line_len - len | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func s:test() | |
new | |
let bufnr = bufnr('') | |
call prop_type_add('one', {}) | |
call prop_type_add('two', {}) | |
call setline(1, 'one two three') | |
call setline(2, 'one two three') | |
wincmd w | |
call prop_add(1, 5, {'length': 3, 'id': 12, 'type': 'two', 'bufnr': bufnr}) | |
call prop_add(2, 1, {'length': 3, 'id': 11, 'type': 'one', 'bufnr': bufnr}) | |
call prop_remove({'id': 12, 'bufnr': bufnr}, 1) | |
close " SEGV | |
endfunc | |
call s:test() | |
qa! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
実行方法
new
で作ったバッファテキストを設定し、最初のバッファに戻ってからテキストプロパティを設定していっていき、最後に現在のバッファ、テキストプロパティを設定していないバッファを閉じるとクラッシュする。f_prop_remove
の実装を眺めると1箇所だけcurbuf
を触っている箇所があったのでここをbuf
に直したところクラッシュしなくなった。ただし
memline
の構造を把握できておらず、修正前が明らかに問題なのはなんとなくわかるが厳密にどう問題かは理解できていない 😇