File vim-9.1.1683-avoid-null-dereference.patch of Package vim.40859
diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index 477af7a54..b98988157 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -701,4 +701,28 @@ func Test_xxd_overflow()
call assert_equal(expected, getline(1, 5))
bw!
endfunc
+
+" this caused a NULL derefence
+func Test_xxd_null_dereference()
+ CheckUnix
+ CheckExecutable /bin/true
+ new
+ " we are only checking, that there are addresses in the first 5 lines
+ let expected = [
+ \ '00000000: ',
+ \ '00000010: ',
+ \ '00000020: ',
+ \ '00000030: ',
+ \ '00000040: ']
+ exe "0r! " s:xxd_cmd "-a -R never /bin/true 2>&1"
+ " there should be more than 6 lines
+ call assert_true(line('$') > 5)
+ " there should not be an ASAN error message
+ call getline(1, '$')->join('\n')->assert_notmatch('runtime error')
+ 6,$d
+ %s/^\x\+: \zs.*//g
+ call assert_equal(expected, getline(1, 5))
+ bw!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/version.c b/src/version.c
index 14178370a..8eada7881 100644
--- a/src/version.c
+++ b/src/version.c
@@ -719,6 +719,114 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1683,
+/**/
+ 1682,
+/**/
+ 1681,
+/**/
+ 1680,
+/**/
+ 1679,
+/**/
+ 1678,
+/**/
+ 1677,
+/**/
+ 1676,
+/**/
+ 1675,
+/**/
+ 1674,
+/**/
+ 1673,
+/**/
+ 1672,
+/**/
+ 1671,
+/**/
+ 1670,
+/**/
+ 1669,
+/**/
+ 1668,
+/**/
+ 1667,
+/**/
+ 1666,
+/**/
+ 1665,
+/**/
+ 1664,
+/**/
+ 1663,
+/**/
+ 1662,
+/**/
+ 1661,
+/**/
+ 1660,
+/**/
+ 1659,
+/**/
+ 1658,
+/**/
+ 1657,
+/**/
+ 1656,
+/**/
+ 1655,
+/**/
+ 1654,
+/**/
+ 1653,
+/**/
+ 1652,
+/**/
+ 1651,
+/**/
+ 1650,
+/**/
+ 1649,
+/**/
+ 1648,
+/**/
+ 1647,
+/**/
+ 1646,
+/**/
+ 1645,
+/**/
+ 1644,
+/**/
+ 1643,
+/**/
+ 1642,
+/**/
+ 1641,
+/**/
+ 1640,
+/**/
+ 1639,
+/**/
+ 1638,
+/**/
+ 1637,
+/**/
+ 1636,
+/**/
+ 1635,
+/**/
+ 1634,
+/**/
+ 1633,
+/**/
+ 1632,
+/**/
+ 1631,
+/**/
+ 1630,
/**/
1629,
/**/
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 36a5a88ec..00102359a 100644
--- a/src/xxd/xxd.c
+++ b/src/xxd/xxd.c
@@ -68,6 +68,9 @@
* 11.11.2024 improve end-of-options argument parser #9285
* 07.12.2024 fix overflow with xxd --autoskip and large sparse files #16175
* 15.06.2025 improve color code logic
+ * 08.08.2025 fix overflow with bitwise output
+ * 20.08.2025 remove external library call for autoconversion on z/OS (MVS)
+ * 24.08.2025 avoid NULL dereference with autoskip colorless
*
* (c) 1990-1998 by Juergen Weigert (jnweiger@gmail.com)
*
@@ -148,7 +151,7 @@ extern void perror __P((char *));
# endif
#endif
-char version[] = "xxd 2025-08-08 by Juergen Weigert et al.";
+char version[] = "xxd 2025-08-24 by Juergen Weigert et al.";
#ifdef WIN32
char osver[] = " (Win32)";
#else
@@ -597,7 +600,10 @@ xxdline(FILE *fp, char *l, char *colors, int nz)
if (!nz && zero_seen == 1)
{
strcpy(z, l);
- memcpy(z_colors, colors, strlen(z));
+ if (colors)
+ {
+ memcpy(z_colors, colors, strlen(z));
+ }
}
if (nz || !zero_seen++)