* read.c (s_incbin): Adjust default count for skip. Check validity
of count and skip rigorously.
+2005-01-20 Alan Modra <amodra@bigpond.net.au>
+
+ PR gas/684
+ * read.c (s_incbin): Adjust default count for skip. Check validity
+ of count and skip rigorously.
+
2005-01-19 Fred Fish <fnf@specifixinc.com>
* config/tc-mips.c (dummy_opcode): Add init for new struct member.
}
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;
}