patch 8.1.0985: crash with large number in regexp
Problem: Crash with large number in regexp. (Kuang-che Wu)
Solution: Check for long becoming negative int. (closes #)
diff --git a/src/testdir/test_search.vim b/src/testdir/test_search.vim
index 5cf70d4..d32369d 100644
--- a/src/testdir/test_search.vim
+++ b/src/testdir/test_search.vim
@@ -1212,13 +1212,36 @@
call Incsearch_cleanup()
endfunc
-func Test_large_hex_chars()
+func Test_large_hex_chars1()
" This used to cause a crash, the character becomes an NFA state.
try
/\%Ufffffc23
catch
call assert_match('E678:', v:exception)
endtry
+ try
+ set re=1
+ /\%Ufffffc23
+ catch
+ call assert_match('E678:', v:exception)
+ endtry
+ set re&
+endfunc
+
+func Test_large_hex_chars2()
+ " This used to cause a crash, the character becomes an NFA state.
+ try
+ /[\Ufffffc1f]
+ catch
+ call assert_match('E486:', v:exception)
+ endtry
+ try
+ set re=1
+ /[\Ufffffc1f]
+ catch
+ call assert_match('E486:', v:exception)
+ endtry
+ set re&
endfunc
func Test_one_error_msg()