objcopy --strip-symbols and similar with file arg

Message ID aorPTufUC8QEMFzZ@squeak.grove.modra.org
State New
Headers
Series objcopy --strip-symbols and similar with file arg |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_binutils_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_binutils_build--master-aarch64 fail Patch failed to apply

Commit Message

Alan Modra Aug. 23, 2026, 10:45 a.m. UTC
  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.
  

Comments

Mostafa Essawy Aug. 27, 2026, 8:05 a.m. UTC | #1
>
> Hello,
>
> I’m following up regarding the security vulnerability I reported in GNU
> Binutils 2.47 affecting objcopy.
>
> Thank you for reviewing and addressing the issue.
>
> I wanted to ask about the next steps in the vulnerability disclosure
> process. In particular:
>
>    - Is the issue expected to receive a CVE identifier?
>    - Is there an expected timeline for the fix/release and public
>    disclosure?
>    - Does the Binutils project offer any financial reward or bounty for
>    responsibly reported security vulnerabilities?
>
> Thank you again for your time and for looking into the report.
>
> Best regards,
> Mostafa
>
  
Alan Modra Aug. 27, 2026, 1:16 p.m. UTC | #2
On Thu, Aug 27, 2026 at 11:05:06AM +0300, Mostafa Essawy wrote:
> >    - Is the issue expected to receive a CVE identifier?

No.

> >    - Is there an expected timeline for the fix/release and public
> >    disclosure?

The fix will appear in the next binutils release.  The mailing lists
are public so the bug is known to anyone who reads them.

> >    - Does the Binutils project offer any financial reward or bounty for
> >    responsibly reported security vulnerabilities?

Not that I'm aware of.
  

Patch

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;