public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Michal Hlavinka <mhlavink@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/avr-binutils] f44: fix CVE-2026-19582: a potential buffer overflow in rsrc_resource_name (rhbz#2519351)
Date: Mon, 05 Oct 2026 10:02:12 GMT	[thread overview]
Message-ID: <179119453229.1.3081282492654036145.rpms-avr-binutils-c8f62ebf6641@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/avr-binutils
Branch : f44
Commit : c8f62ebf66410aae6b8f74904aa2b782e9612d8b
Author : Michal Hlavinka <mhlavink@redhat.com>
Date   : 2026-10-05T11:32:35+02:00
Stats  : +244/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/avr-binutils/c/c8f62ebf66410aae6b8f74904aa2b782e9612d8b?branch=f44

Log:
fix CVE-2026-19582: a potential buffer overflow in rsrc_resource_name (rhbz#2519351)

---
diff --git a/avr-binutils-2.45-CVE-2026-19582.patch b/avr-binutils-2.45-CVE-2026-19582.patch
new file mode 100644
index 0000000..debff66
--- /dev/null
+++ b/avr-binutils-2.45-CVE-2026-19582.patch
@@ -0,0 +1,238 @@
+From 192afd3ce7c2324cdbee2d4646df6cf1e9b6fd09 Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Wed, 2 Sep 2026 09:55:01 +0100
+Subject: [PATCH] Fix CVE-2026-19582 - a potential buffer overflow in
+ rsrc_resource_name.
+
+---
+ bfd/peXXigen.c | 163 +++++++++++++++++++++++++++++++++++--------------
+ 1 file changed, 116 insertions(+), 47 deletions(-)
+
+diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
+index 9794ecdaabe..17a94c461fe 100644
+--- a/bfd/peXXigen.c
++++ b/bfd/peXXigen.c
+@@ -3811,92 +3811,152 @@ rsrc_cmp (bool is_name, rsrc_entry * a, rsrc_entry * b)
+   return res;
+ }
+ 
+-static void
+-rsrc_print_name (char * buffer, rsrc_string string)
++static bool
++rsrc_string_print_str (rsrc_string buffer, const char * format, char * context)
++{
++  if (buffer.string == NULL || buffer.len == 0)
++    return false;
++
++  int printed = snprintf ((char *) buffer.string, buffer.len, format, context);
++
++  if (printed >= (int) buffer.len)
++    {
++      buffer.len = 0;
++      return false;
++    }
++
++  buffer.string += printed;
++  buffer.len    -= printed;
++  return true;
++}
++
++static bool
++rsrc_string_print_int (rsrc_string buffer, const char * format, int context)
++{
++  if (buffer.string == NULL || buffer.len == 0)
++    return false;
++
++  int printed = snprintf ((char *) buffer.string, buffer.len, format, context);
++
++  if (printed >= (int) buffer.len)
++    {
++      buffer.len = 0;
++      return false;
++    }
++
++  buffer.string += printed;
++  buffer.len    -= printed;
++  return true;
++}
++
++static bool
++rsrc_print_name (rsrc_string buffer, rsrc_string string)
+ {
+   unsigned int  i;
+   bfd_byte *    name = string.string;
+ 
+   for (i = string.len; i--; name += 2)
+-    sprintf (buffer + strlen (buffer), "%.1s", name);
++    {
++      if (! rsrc_string_print_str (buffer, "%.1s", (char *) name))
++	return false;
++    }
++
++  return true;
+ }
+ 
+-static const char *
+-rsrc_resource_name (rsrc_entry *entry, rsrc_directory *dir, char *buffer)
++static bool
++rsrc_resource_name (rsrc_entry *entry, rsrc_directory *dir, rsrc_string buffer)
+ {
+   bool is_string = false;
++  bool res = true;
+ 
+-  buffer[0] = 0;
++  if (buffer.string == NULL || buffer.len == 0)
++    return false;
++
++  buffer.string[0] = 0;
+ 
+-  if (dir != NULL && dir->entry != NULL && dir->entry->parent != NULL
++  if (dir != NULL
++      && dir->entry != NULL
++      && dir->entry->parent != NULL
+       && dir->entry->parent->entry != NULL)
+     {
+-      strcpy (buffer, "type: ");
++      res &= rsrc_string_print_str (buffer, "%s", "type: ");
++
+       if (dir->entry->parent->entry->is_name)
+-	rsrc_print_name (buffer + strlen (buffer),
+-			 dir->entry->parent->entry->name_id.name);
++	{
++	  res &= rsrc_print_name (buffer, dir->entry->parent->entry->name_id.name);
++	}
+       else
+ 	{
+ 	  unsigned int id = dir->entry->parent->entry->name_id.id;
+ 
+-	  sprintf (buffer + strlen (buffer), "%x", id);
++	  res &= rsrc_string_print_int (buffer, "%x", id);
++
+ 	  switch (id)
+ 	    {
+-	    case 1: strcat (buffer, " (CURSOR)"); break;
+-	    case 2: strcat (buffer, " (BITMAP)"); break;
+-	    case 3: strcat (buffer, " (ICON)"); break;
+-	    case 4: strcat (buffer, " (MENU)"); break;
+-	    case 5: strcat (buffer, " (DIALOG)"); break;
+-	    case 6: strcat (buffer, " (STRING)"); is_string = true; break;
+-	    case 7: strcat (buffer, " (FONTDIR)"); break;
+-	    case 8: strcat (buffer, " (FONT)"); break;
+-	    case 9: strcat (buffer, " (ACCELERATOR)"); break;
+-	    case 10: strcat (buffer, " (RCDATA)"); break;
+-	    case 11: strcat (buffer, " (MESSAGETABLE)"); break;
+-	    case 12: strcat (buffer, " (GROUP_CURSOR)"); break;
+-	    case 14: strcat (buffer, " (GROUP_ICON)"); break;
+-	    case 16: strcat (buffer, " (VERSION)"); break;
+-	    case 17: strcat (buffer, " (DLGINCLUDE)"); break;
+-	    case 19: strcat (buffer, " (PLUGPLAY)"); break;
+-	    case 20: strcat (buffer, " (VXD)"); break;
+-	    case 21: strcat (buffer, " (ANICURSOR)"); break;
+-	    case 22: strcat (buffer, " (ANIICON)"); break;
+-	    case 23: strcat (buffer, " (HTML)"); break;
+-	    case 24: strcat (buffer, " (MANIFEST)"); break;
+-	    case 240: strcat (buffer, " (DLGINIT)"); break;
+-	    case 241: strcat (buffer, " (TOOLBAR)"); break;
++	    case   1: res &= rsrc_string_print_str (buffer, "%s", " (CURSOR)"); break;
++	    case   2: res &= rsrc_string_print_str (buffer, "%s", " (BITMAP)"); break;
++	    case   3: res &= rsrc_string_print_str (buffer, "%s", " (ICON)"); break;
++	    case   4: res &= rsrc_string_print_str (buffer, "%s", " (MENU)"); break;
++	    case   5: res &= rsrc_string_print_str (buffer, "%s", " (DIALOG)"); break;
++	    case   6: res &= rsrc_string_print_str (buffer, "%s", " (STRING)"); is_string = true; break;
++	    case   7: res &= rsrc_string_print_str (buffer, "%s", " (FONTDIR)"); break;
++	    case   8: res &= rsrc_string_print_str (buffer, "%s", " (FONT)"); break;
++	    case   9: res &= rsrc_string_print_str (buffer, "%s", " (ACCELERATOR)"); break;
++	    case  10: res &= rsrc_string_print_str (buffer, "%s", " (RCDATA)"); break;
++	    case  11: res &= rsrc_string_print_str (buffer, "%s", " (MESSAGETABLE)"); break;
++	    case  12: res &= rsrc_string_print_str (buffer, "%s", " (GROUP_CURSOR)"); break;
++	    case  14: res &= rsrc_string_print_str (buffer, "%s", " (GROUP_ICON)"); break;
++	    case  16: res &= rsrc_string_print_str (buffer, "%s", " (VERSION)"); break;
++	    case  17: res &= rsrc_string_print_str (buffer, "%s", " (DLGINCLUDE)"); break;
++	    case  19: res &= rsrc_string_print_str (buffer, "%s", " (PLUGPLAY)"); break;
++	    case  20: res &= rsrc_string_print_str (buffer, "%s", " (VXD)"); break;
++	    case  21: res &= rsrc_string_print_str (buffer, "%s", " (ANICURSOR)"); break;
++	    case  22: res &= rsrc_string_print_str (buffer, "%s", " (ANIICON)"); break;
++	    case  23: res &= rsrc_string_print_str (buffer, "%s", " (HTML)"); break;
++	    case  24: res &= rsrc_string_print_str (buffer, "%s", " (MANIFEST)"); break;
++	    case 240: res &= rsrc_string_print_str (buffer, "%s", " (DLGINIT)"); break;
++	    case 241: res &= rsrc_string_print_str (buffer, "%s", " (TOOLBAR)"); break;
+ 	    }
+ 	}
+     }
+ 
+   if (dir != NULL && dir->entry != NULL)
+     {
+-      strcat (buffer, " name: ");
++      res &= rsrc_string_print_str (buffer, "%s", " name: ");
++
+       if (dir->entry->is_name)
+-	rsrc_print_name (buffer + strlen (buffer), dir->entry->name_id.name);
++	{
++	  res &= rsrc_print_name (buffer, dir->entry->name_id.name);
++	}
+       else
+ 	{
+ 	  unsigned int id = dir->entry->name_id.id;
+ 
+-	  sprintf (buffer + strlen (buffer), "%x", id);
++	  res &= rsrc_string_print_int (buffer, "%x", id);
+ 
+ 	  if (is_string)
+-	    sprintf (buffer + strlen (buffer), " (resource id range: %d - %d)",
+-		     (id - 1) << 4, (id << 4) - 1);
++	    {
++	      res &= rsrc_string_print_str (buffer, "%s", " (resource id range: ");
++	      res &= rsrc_string_print_int (buffer, "%d", (id - 1) << 4);
++	      res &= rsrc_string_print_str (buffer, "%s", " - ");
++	      res &= rsrc_string_print_int (buffer, "%d", (id << 4) - 1);
++	      res &= rsrc_string_print_str (buffer, "%s", ")");
++	    }
+ 	}
+     }
+ 
+   if (entry != NULL)
+     {
+-      strcat (buffer, " lang: ");
++      res &= rsrc_string_print_str (buffer, "%s", " lang: ");
+ 
+       if (entry->is_name)
+-	rsrc_print_name (buffer + strlen (buffer), entry->name_id.name);
++	res &= rsrc_print_name (buffer, entry->name_id.name);
+       else
+-	sprintf (buffer + strlen (buffer), "%x", entry->name_id.id);
++	res &= rsrc_string_print_int (buffer, "%x", entry->name_id.id);
+     }
+ 
+-  return buffer;
++  return res;
+ }
+ 
+ /* *sigh* Windows resource strings are special.  Only the top 28-bits of
+@@ -4156,11 +4216,20 @@ rsrc_sort_entries (rsrc_dir_chain *chain,
+ 			_bfd_error_handler (_(".rsrc merge failure: duplicate leaf"));
+ 		      else
+ 			{
+-			  char buff[256];
+-
+-			  _bfd_error_handler (_(".rsrc merge failure: duplicate leaf: %s"),
+-					      rsrc_resource_name (entry, dir, buff));
++#define RSRC_RES_NAME_LEN 256
++			  char buff[RSRC_RES_NAME_LEN];
++			  rsrc_string buffer;
++
++			  buffer.string = (bfd_byte *) buff;
++			  buffer.len = RSRC_RES_NAME_LEN;
++
++			  if (rsrc_resource_name (entry, dir, buffer))
++			    _bfd_error_handler (_(".rsrc merge failure: duplicate leaf: %s"),
++						buffer.string);
++			  else
++			    _bfd_error_handler (_(".rsrc merge failure: duplicate leaf"));
+ 			}
++
+ 		      bfd_set_error (bfd_error_file_truncated);
+ 		      return;
+ 		    }
+-- 
+2.43.7
+

diff --git a/avr-binutils.spec b/avr-binutils.spec
index 43e1e35..7651ceb 100644
--- a/avr-binutils.spec
+++ b/avr-binutils.spec
@@ -2,7 +2,7 @@
 
 Name:           %{target}-binutils
 Version:        2.45
-Release:        7%{?dist}
+Release:        8%{?dist}
 Epoch:          1
 Summary:        Cross Compiling GNU binutils targeted at %{target}
 License:        GPL-2.0-or-later
@@ -18,6 +18,7 @@ Patch3:         binutils-2.45-cve-2025-11081.patch
 Patch4:         binutils-2.45-cve-2025-11082.patch
 # from upstream, for == 2.45, rhbz#2400336
 Patch5:         binutils-2.45-cve-2025-11083.patch
+Patch6:         avr-binutils-2.45-CVE-2026-19582.patch
 
 BuildRequires:  gawk texinfo gcc
 #for autoreconf:
@@ -40,6 +41,7 @@ pushd binutils-%{version}
 %patch -P 3 -p1 -b .cve-2025-11081
 %patch -P 4 -p1 -b .cve-2025-11082
 %patch -P 5 -p1 -b .cve-2025-11083
+%patch -P 6 -p1 -b .2.45-CVE-2026-19582
 
 # We call configure directly rather than via macros, thus if
 # we are using LTO, we have to manually fix the broken configure
@@ -93,6 +95,9 @@ rm    $RPM_BUILD_ROOT%{_libdir}/lib*.a $RPM_BUILD_ROOT%{_libdir}/bfd-plugins/lib
 
 
 %changelog
+* Mon Oct 05 2026 Michal Hlavinka <mhlavink@redhat.com> - 1:2.45-8
+- fix CVE-2026-19582: a potential buffer overflow in rsrc_resource_name (rhbz#2519351)
+
 * Wed Jul 15 2026 Fedora Release Engineering <releng@fedoraproject.org> - 1:2.45-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_45_Mass_Rebuild
 

                 reply	other threads:[~2026-10-05 10:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179119453229.1.3081282492654036145.rpms-avr-binutils-c8f62ebf6641@fedoraproject.org \
    --to=mhlavink@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox