When decoding SLEB128, make sure sign extension is performed for

64-bit integers.

MFC after:	3 days
This commit is contained in:
Kai Wang 2013-06-30 21:06:47 +00:00
parent 61c2a6184e
commit 3254dc0a2b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=252430
2 changed files with 2 additions and 2 deletions

View file

@ -192,7 +192,7 @@ dwarf_read_sleb128(Elf_Data **dp, uint64_t *offsetp)
shift += 7;
} while ((b & 0x80) != 0);
if (shift < 32 && (b & 0x40) != 0)
if (shift < 64 && (b & 0x40) != 0)
ret |= (-1 << shift);
return ret;

View file

@ -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;