* dlltool.c (dump_iat): Remove unused function.
[deliverable/binutils-gdb.git] / gas / read.c
index e04e00c865fe3ec48922567a3ebe0868620038d5..daea0f9a071fda41c92f226c75d2fa785d168298 100644 (file)
@@ -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;
        }
This page took 0.0236 seconds and 4 git commands to generate.