do not allow size or nbytes to go negative.

This commit is contained in:
Nick Clifton 2002-01-07 17:51:18 +00:00
parent be2d1673e4
commit ceac3f6271
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2002-01-07 Nick Clifton <nickc@cambridge.redhat.com>
* read.c (emit_expr): Do not allow 'size' or 'nbytes' to go
negative.
2002-01-06 Alan Modra <amodra@bigpond.net.au> 2002-01-06 Alan Modra <amodra@bigpond.net.au>
* config/tc-m68k.h (md_prepare_relax_scan): Rewrite. * config/tc-m68k.h (md_prepare_relax_scan): Rewrite.

View File

@ -3683,7 +3683,7 @@ emit_expr (exp, nbytes)
} }
nums = generic_bignum + size / CHARS_PER_LITTLENUM; nums = generic_bignum + size / CHARS_PER_LITTLENUM;
while (size > 0) while (size >= CHARS_PER_LITTLENUM)
{ {
--nums; --nums;
md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM); md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
@ -3694,7 +3694,7 @@ emit_expr (exp, nbytes)
else else
{ {
nums = generic_bignum; nums = generic_bignum;
while (size > 0) while (size >= CHARS_PER_LITTLENUM)
{ {
md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM); md_number_to_chars (p, (valueT) *nums, CHARS_PER_LITTLENUM);
++nums; ++nums;
@ -3703,7 +3703,7 @@ emit_expr (exp, nbytes)
nbytes -= CHARS_PER_LITTLENUM; nbytes -= CHARS_PER_LITTLENUM;
} }
while (nbytes > 0) while (nbytes >= CHARS_PER_LITTLENUM)
{ {
md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM); md_number_to_chars (p, extra_digit, CHARS_PER_LITTLENUM);
nbytes -= CHARS_PER_LITTLENUM; nbytes -= CHARS_PER_LITTLENUM;