mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 09:14:14 +08:00
Avoid undefined behaviour with signed expressions
PR 17453 bfd/ * libbfd.c (COERCE16, COERCE32, COERCE64): Use unsigned types. (EIGHT_GAZILLION): Delete. binutils/ * dwarf.c (read_leb128): Avoid signed overflow. (read_debug_line_header): Likewise. gas/ * config/tc-i386.c (fits_in_signed_long): Use unsigned param and expression to avoid signed overflow. (fits_in_signed_byte, fits_in_unsigned_byte, fits_in_unsigned_word, fits_in_signed_word, fits_in_unsigned_long): Similarly. * expr.c (operand <'-'>): Avoid signed overflow. * read.c (s_comm_internal): Likewise.
This commit is contained in:
@ -1021,7 +1021,8 @@ operand (expressionS *expressionP, enum expr_mode mode)
|
||||
/* input_line_pointer -> char after operand. */
|
||||
if (c == '-')
|
||||
{
|
||||
expressionP->X_add_number = - expressionP->X_add_number;
|
||||
expressionP->X_add_number
|
||||
= - (addressT) expressionP->X_add_number;
|
||||
/* Notice: '-' may overflow: no warning is given.
|
||||
This is compatible with other people's
|
||||
assemblers. Sigh. */
|
||||
|
Reference in New Issue
Block a user