objcopy --strip-symbols and similar with file arg
Alan Modra <[email protected]>
| Newsgroups | gmane.comp.gnu.binutils |
|---|---|
| Message-ID | <[email protected]> |
If something like --strip-symbols /dev/urandom is passed to objcopy
we get a -1 return from get_file_size which isn't checked. Things go
downhill from there.
From https://lists.gnu.org/archive/html/bug-binutils/2026-08/msg00083.html
* objcopy.c (add_specific_symbols): Fail on negative return
from get_file_size.
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 4ab7e8997b5..609bb311a9a 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1134,7 +1134,7 @@ add_specific_symbols (const char *filename, htab_t htab, char **buffer_p)
unsigned int line_count;
size = get_file_size (filename);
- if (size == 0)
+ if (size < 1)
{
status = 1;
return;
--
Alan Modra