Fix gas/684: .incbin pseudo
Alan Modra
amodra@bigpond.net.au
Thu Jan 20 06:45:00 GMT 2005
PR gas/684
* read.c (s_incbin): Adjust default count for skip. Check validity
of count and skip rigorously.
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.85
diff -u -p -r1.85 read.c
--- gas/read.c 19 Jan 2005 11:53:50 -0000 1.85
+++ gas/read.c 20 Jan 2005 06:44:07 -0000
@@ -5000,13 +5000,13 @@ s_incbin (int x ATTRIBUTE_UNUSED)
}
file_len = ftell (binfile);
- /* If a count was not specified use the size of the file. */
+ /* If a count was not specified use the remainder of the file. */
if (count == 0)
- count = file_len;
+ count = file_len - skip;
- if (skip + count > file_len)
+ if (skip < 0 || count < 0 || file_len < 0 || skip + count > file_len)
{
- as_bad (_("skip (%ld) + count (%ld) larger than file size (%ld)"),
+ as_bad (_("skip (%ld) or count (%ld) invalid for file size (%ld)"),
skip, count, file_len);
goto done;
}
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list