Commit 88ceb91b authored by Tyler Langlois's avatar Tyler Langlois
Browse files

binutils: fix CVE-2025-5245

Backport derived from upstream commit; see:
https://nvd.nist.gov/vuln/detail/CVE-2025-5245
parent 25e606dd
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
Backported patch originally targeted against 2.45.
--- a/binutils/debug.c
+++ b/binutils/debug.c
@@ -2554,9 +2554,6 @@ debug_write_type (struct debug_handle *info,
     case DEBUG_KIND_UNION_CLASS:
       return debug_write_class_type (info, fns, fhandle, type, tag);
     case DEBUG_KIND_ENUM:
-      if (type->u.kenum == NULL)
-	return (*fns->enum_type) (fhandle, tag, (const char **) NULL,
-				  (bfd_signed_vma *) NULL);
       return (*fns->enum_type) (fhandle, tag, type->u.kenum->names,
 				type->u.kenum->values);
     case DEBUG_KIND_POINTER:
@@ -3097,9 +3094,9 @@ debug_type_samep (struct debug_handle *info, struct debug_type_s *t1,
       break;

     case DEBUG_KIND_ENUM:
-      if (t1->u.kenum == NULL)
-	ret = t2->u.kenum == NULL;
-      else if (t2->u.kenum == NULL)
+      if (t1->u.kenum->names == NULL)
+	ret = t2->u.kenum->names == NULL;
+      else if (t2->u.kenum->names == NULL)
 	ret = false;
       else
 	{
+4 −0
Original line number Diff line number Diff line
@@ -122,6 +122,10 @@ stdenv.mkDerivation (finalAttrs: {
    # Backported against CVE patched in the 2.45 series. See:
    # https://nvd.nist.gov/vuln/detail/CVE-2025-5244
    ./CVE-2025-5244.diff

    # Backported against CVE patched in the 2.45 series. See:
    # https://nvd.nist.gov/vuln/detail/CVE-2025-5245
    ./CVE-2025-5245.diff
  ];

  outputs = [