Add a sanity check of files include by .incbin.
[deliverable/binutils-gdb.git] / gas / read.c
index 06ca7fbb95f7b567df875279bc642558ef22a268..ede811b0a0337c6f3199dc89d825824f2cafcf3b 100644 (file)
@@ -5909,7 +5909,16 @@ s_incbin (int x ATTRIBUTE_UNUSED)
   if (binfile)
     {
       long   file_len;
+      struct stat filestat;
 
+      if (fstat (fileno (binfile), &filestat) != 0
+         || ! S_ISREG (filestat.st_mode)
+         || S_ISDIR (filestat.st_mode))
+       {
+         as_bad (_("unable to include `%s'"), path);
+         goto done;
+       }
+      
       register_dependency (path);
 
       /* Compute the length of the file.  */
This page took 0.024359 seconds and 4 git commands to generate.