patch 9.0.2066: xxd: corrupting files when reversing bit dumps

Commit: 
https://github.com/vim/vim/commit/1c14030aff238abef03bdf87e6b33c7e5d7ffd51
Author: OldWorldOrdr <[email protected]>
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 <[email protected]>
    Co-authored-by: K.Takata <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>
    Signed-off-by: K.Takata <[email protected]>
    Signed-off-by: tristhaus <[email protected]>

diff --git a/src/testdir/test_xxd.vim b/src/testdir/test_xxd.vim
index 53e1a95c3..7a2771e03 100644
--- a/src/testdir/test_xxd.vim
+++ b/src/testdir/test_xxd.vim
@@ -373,6 +373,13 @@ func Test_xxd_revert_bit_dump()
   bwipe!
 endfunc
 
+func Test_xxd_roundtrip_large_bit_dump()
+  new
+  exe 'r! printf 
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" | ' . 
s:xxd_cmd . ' -b | ' . s:xxd_cmd . ' -r -b'
+  call 
assert_match('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ012345678', 
join(getline(1, 3)))
+  bwipe!
+endfunc
+
 func Test_xxd_version()
   new
   exe 'r! ' . s:xxd_cmd . ' -v'
diff --git a/src/version.c b/src/version.c
index 9198a788b..e45d7fa0b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2066,
 /**/
     2065,
 /**/
diff --git a/src/xxd/xxd.c b/src/xxd/xxd.c
index 544aa50b9..94a0e6146 100644
--- 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;
         }

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1qvjZr-005CCr-VE%40256bit.org.

Raspunde prin e-mail lui