mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-25 21:41:47 +08:00
Stop the assembler from running out of memory when asked to generate a huge number of spaces.
PR gas/20901 * read.c (s_space): Place an upper limit on the number of spaces generated.
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
2016-12-06 Nick Clifton <nickc@redhat.com>
|
2016-12-06 Nick Clifton <nickc@redhat.com>
|
||||||
|
|
||||||
|
PR gas/20901
|
||||||
|
* read.c (s_space): Place an upper limit on the number of spaces
|
||||||
|
generated.
|
||||||
|
|
||||||
PR gas/20896
|
PR gas/20896
|
||||||
* testsuite/gas/mmix/err-byte1.s: Adjust expected warning messages
|
* testsuite/gas/mmix/err-byte1.s: Adjust expected warning messages
|
||||||
to account for patch to next_char_of_string.
|
to account for patch to next_char_of_string.
|
||||||
|
19
gas/read.c
19
gas/read.c
@ -3394,11 +3394,20 @@ s_space (int mult)
|
|||||||
{
|
{
|
||||||
offsetT i;
|
offsetT i;
|
||||||
|
|
||||||
if (mult == 0)
|
/* PR 20901: Check for excessive values.
|
||||||
mult = 1;
|
FIXME: 1<<10 is an arbitrary limit. Maybe use maxpagesize instead ? */
|
||||||
bytes = mult * exp.X_add_number;
|
if (exp.X_add_number < 0 || exp.X_add_number > (1 << 10))
|
||||||
for (i = 0; i < exp.X_add_number; i++)
|
as_bad (_("size value for s_space directive too large: %lx"),
|
||||||
emit_expr (&val, mult);
|
(long) exp.X_add_number);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (mult == 0)
|
||||||
|
mult = 1;
|
||||||
|
bytes = mult * exp.X_add_number;
|
||||||
|
|
||||||
|
for (i = 0; i < exp.X_add_number; i++)
|
||||||
|
emit_expr (&val, mult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user