asan: readelf leak in hppa_process_unwind
[deliverable/binutils-gdb.git] / binutils / elfedit.c
index 3a14c60ece62b2c4a1f2dd524dff08608c7f9ad4..d0e4e95f4d6ebdfbb88cba87434306ccd8a420bd 100644 (file)
@@ -541,6 +541,7 @@ process_archive (const char * file_name, FILE * file,
   struct archive_info nested_arch;
   size_t got;
   int ret;
+  struct stat statbuf;
 
   /* The ARCH structure is used to hold information about this archive.  */
   arch.file_name = NULL;
@@ -558,7 +559,9 @@ process_archive (const char * file_name, FILE * file,
   nested_arch.sym_table = NULL;
   nested_arch.longnames = NULL;
 
-  if (setup_archive (&arch, file_name, file, is_thin_archive, FALSE) != 0)
+  if (fstat (fileno (file), &statbuf) < 0
+      || setup_archive (&arch, file_name, file, statbuf.st_size,
+                       is_thin_archive, FALSE) != 0)
     {
       ret = 1;
       goto out;
This page took 0.024125 seconds and 4 git commands to generate.