Mercurial > vim
diff src/xxd/xxd.c @ 33654:a3616b5f5b25 v9.0.2066
patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Commit: https://github.com/vim/vim/commit/1c14030aff238abef03bdf87e6b33c7e5d7ffd51
Author: OldWorldOrdr <joey.t.reinhart@gmail.com>
Date: Wed Oct 25 20:57:30 2023 +0200
patch 9.0.2066: xxd: corrupting files when reversing bit dumps
Problem: xxd: corrupting files when reversing bit dumps
Solution: handle reversing bit dump slightly differently
fixes: #13410
closes: #13415
Co-authored-by: OldWorldOrdr <joey.t.reinhart@gmail.com>
Co-authored-by: K.Takata <kentkt@csc.jp>
Signed-off-by: Christian Brabandt <cb@256bit.org>
Signed-off-by: K.Takata <kentkt@csc.jp>
Signed-off-by: tristhaus <tristhaus@yahoo.de>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 25 Oct 2023 21:30:03 +0200 |
parents | e083de1ef4b4 |
children | 38b0ea4d17cc |
line wrap: on
line diff
--- a/src/xxd/xxd.c +++ b/src/xxd/xxd.c @@ -136,7 +136,7 @@ extern void perror __P((char *)); # endif #endif -char version[] = "xxd 2023-10-08 by Juergen Weigert et al."; +char version[] = "xxd 2023-10-24 by Juergen Weigert et al."; #ifdef WIN32 char osver[] = " (Win32)"; #else @@ -418,19 +418,13 @@ huntype( } else /* HEX_BITS */ { - n1 = parse_hex_digit(c); - if (n1 >= 0) - { - want_off = (want_off << 4) | n1; - } - - if (bt < 0) - { - p = 0; + if (n1 < 0) + { + p = 0; bcnt = 0; - b = 0; - continue; - } + continue; + } + want_off = (want_off << 4) | n1; } continue; }