Hi Bram,
How to reproduce:
- Start pure Vim.
$ vim -N -u NONE
- Input characters for test.
i0x123456<Esc>
- Visual block-wise select to '0x123'.
0<C-V>f3
- Do visual increment.
<C-A>
Expected behavior:
Became 0x124456
Actual behavior:
Became 0x123466
Investigation result:
Buffer-overrun occured in vim_str2nr(). [charset.c: 1914]
(When start start from "0x" && dohex && STRLEN(start) == maxlen)
We have forgotten the count of "0x".
I wrote a patch with a test.
Please include this.
--
Best regards,
Hirohito Higashi (a.k.a h_east)
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff --git a/src/charset.c b/src/charset.c
--- a/src/charset.c
+++ b/src/charset.c
@@ -1908,6 +1908,7 @@
}
else if (hex != 0 || dohex > 1)
{
+ n += 2; /* Counting "0x" */
/* hex */
while (vim_isxdigit(*ptr))
{
diff --git a/src/testdir/test_increment.in b/src/testdir/test_increment.in
--- a/src/testdir/test_increment.in
+++ b/src/testdir/test_increment.in
@@ -277,7 +277,15 @@
Expected:
1) <Ctrl-a> and cursor is on a
b
-
+
+21) block-wise increment on part of hexadecimal
+Text:
+0x123456
+
+ Expected:
+ 1) Ctrl-V f3 <ctrl-a>
+0x124456
+
STARTTEST
@@ -401,6 +409,12 @@
:.put =col('.')
:set nrformats&vim
+:" Test 21
+:/^S21=/+,/^E21=/-y a
+:/^E21=/+put a
+:set nrformats&vim
+f3
+
:" Save the report
:/^# Test 1/,$w! test.out
:qa!
@@ -594,6 +608,13 @@
+# Test 21
+S21====
+0x123456
+E21====
+
+
+
ENDTEST
diff --git a/src/testdir/test_increment.ok b/src/testdir/test_increment.ok
--- a/src/testdir/test_increment.ok
+++ b/src/testdir/test_increment.ok
@@ -280,6 +280,14 @@
1
+# Test 21
+S21====
+0x123456
+E21====
+
+0x124456
+
+
ENDTEST