0
0
mirror of https://github.com/vim/vim.git synced 2025-11-15 23:14:06 -05:00

patch 9.1.1683: xxd: Avoid null dereference in autoskip colorless

Problem:  xxd: Avoid null dereference in autoskip colorless
Solution: Verify that colors is not null (Joakim Nohlgård)

Fixes bug introduced in 6897f18ee6
(v9.1.1459) which does a memcpy from NULL when color=never and the
autoskip option is used.

Before:

dd if=/dev/zero bs=100 count=1 status=none | xxd -a -R never
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
Segmentation fault (core dumped)

After:

dd if=/dev/zero bs=100 count=1 status=none | ./xxd/xxd -a -R never
00000000: 0000 0000 0000 0000 0000 0000 0000 0000  ................
*
00000060: 0000 0000                                ....

closes: #18008

Signed-off-by: Joakim Nohlgård <joakim@nohlgard.se>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Joakim Nohlgård
2025-08-24 12:36:44 +02:00
committed by Christian Brabandt
parent 99964e2ea7
commit b922b30cfe
3 changed files with 32 additions and 2 deletions

View File

@@ -724,6 +724,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1683,
/**/
1682,
/**/