]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
alpha-ecoff: check archive element size
authorAlan Modra <amodra@gmail.com>
Mon, 6 Oct 2025 10:26:56 +0000 (20:56 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 6 Oct 2025 11:22:28 +0000 (21:52 +1030)
If we run out of file before decompression finishes, the archive is
broken.  Don't allow the buffer to be returned with uninitialised data.

* coff-alpha.c (alpha_ecoff_get_elt_at_filepos): Return an
error if the full element size can't be decompressed.

bfd/coff-alpha.c

index fcc8aef66731ba385caea9535cab591d2443a9f8..9a621e93c5ba6d7c0dfaa512b4de8e1bee23a0d6 100644 (file)
@@ -2204,6 +2204,8 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos,
          if (left == 0)
            break;
        }
+      if (left != 0)
+       goto error_return;
     }
 
   /* Now the uncompressed file contents are in buf.  */