diff mbox series

libbacktrace patch committed: don't skip aligned byte

Message ID CAOyqgcX_JGVVcLzh=gsWP2KeL1Lw0Ekz3tNZ+-CUAuNQOwt0ng@mail.gmail.com
State New
Headers show
Series libbacktrace patch committed: don't skip aligned byte | expand

Commit Message

Ian Lance Taylor April 5, 2022, 11:09 p.m. UTC
This libbacktrace patch by Rui Ueyama fixes handling an uncompressed
block that starts at an aligned byte.  If the bits before the
uncompressed block ended at a byte boundary, libbacktrace accidentally
skipped the next byte, which is the first byte of the length of the
block.  Bootstrapped and ran libbacktrace tests on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian

            * elf.c (elf_zlib_inflate): Don't skip initial aligned byte in
            uncompressed block.
584ae0f0eea2a162dc02984c5976d5cbab5cd1e7
diff mbox series

Patch

diff --git a/libbacktrace/elf.c b/libbacktrace/elf.c
index 5c7c21a8da7..8b82dd45875 100644
--- a/libbacktrace/elf.c
+++ b/libbacktrace/elf.c
@@ -1796,7 +1796,7 @@  elf_zlib_inflate (const unsigned char *pin, size_t sin, uint16_t *zdebug_table,
 	      /* An uncompressed block.  */
 
 	      /* If we've read ahead more than a byte, back up.  */
-	      while (bits > 8)
+	      while (bits >= 8)
 		{
 		  --pin;
 		  bits -= 8;