diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-06-14 16:00:05 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-06-14 16:00:05 -0400 |
| commit | f350e39b772451230fa2e8d867ee9f5ed03bf6e2 (patch) | |
| tree | 6af951079ef8de1f9893fdcf27f36de2c24902e0 /test/functional/vimscript | |
| parent | 6f3446c97078ea55350f37a9e7e905d5fb49a881 (diff) | |
| download | rneovim-f350e39b772451230fa2e8d867ee9f5ed03bf6e2.tar.gz rneovim-f350e39b772451230fa2e8d867ee9f5ed03bf6e2.tar.bz2 rneovim-f350e39b772451230fa2e8d867ee9f5ed03bf6e2.zip | |
fix(xxd): signed left-shift overflow in -r mode #40246
(AI-assisted)
Problem:
Zig build failing since 966e7a98f5bc:
FAILED ...r/work/neovim/neovim/test/functional/editor/xxd_spec.lua @ 22: xxd handles long lines in revert mode
Expected values to be equal.
Expected:
0
Actual:
134
stack traceback:
...r/work/neovim/neovim/test/functional/editor/xxd_spec.lua:26: in function <...r/work/neovim/neovim/test/functional/editor/xxd_spec.lua:22>
`huntype` parses the address column by repeatedly left-shifting
`want_off` (a signed `long`) by 4 bits per hex digit. After 16 hex
digits the value occupies all 64 bits; the next shift moves a non-zero
bit into the sign bit -- signed overflow, i.e. undefined behavior.
This happens on the Zig build because it enables UBSAN. The bug was
pre-existing, but 966e7a98f5bc added a test that exercises it.
Solution
Shift through `unsigned long` and cast back to `long`, making the
overflow well-defined wrap-around.
Diffstat (limited to 'test/functional/vimscript')
0 files changed, 0 insertions, 0 deletions