public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* libbacktrace patch committed: don't skip aligned byte
@ 2022-04-05 23:09 Ian Lance Taylor
  0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2022-04-05 23:09 UTC (permalink / raw)
  To: gcc-patches; +Cc: rui314

[-- Attachment #1: Type: text/plain, Size: 479 bytes --]

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.

[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 470 bytes --]

584ae0f0eea2a162dc02984c5976d5cbab5cd1e7
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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-05 23:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-05 23:09 libbacktrace patch committed: don't skip aligned byte Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).