diff options
author | Alan Modra <amodra@gmail.com> | 2005-01-20 06:46:41 +0000 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2005-01-20 06:46:41 +0000 |
commit | c556cc9c6d052eef25dbb030a297cc0e204ba5c7 (patch) | |
tree | 08cb030f8cc153c6578c37241412224b50d43432 /gas/read.c | |
parent | d17d003345eb4816548ff9da5c97fb7a76df714e (diff) | |
download | gdb-c556cc9c6d052eef25dbb030a297cc0e204ba5c7.zip gdb-c556cc9c6d052eef25dbb030a297cc0e204ba5c7.tar.gz gdb-c556cc9c6d052eef25dbb030a297cc0e204ba5c7.tar.bz2 |
PR gas/684
* read.c (s_incbin): Adjust default count for skip. Check validity
of count and skip rigorously.
Diffstat (limited to 'gas/read.c')
-rw-r--r-- | gas/read.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; } |