* Fix gas/684: .incbin pseudo
@ 2005-01-20 6:45 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2005-01-20 6:45 UTC (permalink / raw)
To: binutils
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-01-20 6:45 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-20 6:45 Fix gas/684: .incbin pseudo Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).