Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 30 Jun 2013 21:06:48 +0000 (UTC)
From:      Kai Wang <kaiw@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r252430 - head/lib/libdwarf
Message-ID:  <201306302106.r5UL6mw9032834@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kaiw
Date: Sun Jun 30 21:06:47 2013
New Revision: 252430
URL: http://svnweb.freebsd.org/changeset/base/252430

Log:
  When decoding SLEB128, make sure sign extension is performed for
  64-bit integers.
  
  MFC after:	3 days

Modified:
  head/lib/libdwarf/dwarf_init.c
  head/lib/libdwarf/dwarf_loc.c

Modified: head/lib/libdwarf/dwarf_init.c
==============================================================================
--- head/lib/libdwarf/dwarf_init.c	Sun Jun 30 20:51:15 2013	(r252429)
+++ head/lib/libdwarf/dwarf_init.c	Sun Jun 30 21:06:47 2013	(r252430)
@@ -192,7 +192,7 @@ dwarf_read_sleb128(Elf_Data **dp, uint64
 		shift += 7;
 	} while ((b & 0x80) != 0);
 
-	if (shift < 32 && (b & 0x40) != 0)
+	if (shift < 64 && (b & 0x40) != 0)
 		ret |= (-1 << shift);
 
 	return ret;

Modified: head/lib/libdwarf/dwarf_loc.c
==============================================================================
--- head/lib/libdwarf/dwarf_loc.c	Sun Jun 30 20:51:15 2013	(r252429)
+++ head/lib/libdwarf/dwarf_loc.c	Sun Jun 30 21:06:47 2013	(r252430)
@@ -46,7 +46,7 @@ dwarf_decode_sleb128(uint8_t **dp)
 		shift += 7;
 	} while ((b & 0x80) != 0);
 
-	if (shift < 32 && (b & 0x40) != 0)
+	if (shift < 64 && (b & 0x40) != 0)
 		ret |= (-1 << shift);
 
 	*dp = src;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306302106.r5UL6mw9032834>