forked from microsoft/azurelinux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix CVE-2025-0840 for binutils (microsoft#12254)
Co-authored-by: Sam Meluch <109628994+sameluch@users.noreply.github.com> Co-authored-by: jslobodzian <joslobo@microsoft.com>
- Loading branch information
1 parent
8d37859
commit 1ede019
Showing
6 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
From e692412cf74604829a21a7a23857a772d2197788 Mon Sep 17 00:00:00 2001 | ||
From: Sudipta Pandit <sudpandit@microsoft.com> | ||
Date: Fri, 7 Feb 2025 01:57:06 +0530 | ||
Subject: [PATCH] Backport fix for CVE-2025-0840 | ||
|
||
Reference: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=baac6c221e9d69335bf41366a1c7d87d8ab2f893 | ||
|
||
--- | ||
binutils/objdump.c | 10 ++++++---- | ||
1 file changed, 6 insertions(+), 4 deletions(-) | ||
|
||
diff --git a/binutils/objdump.c b/binutils/objdump.c | ||
index a35982ea..2efbf4b0 100644 | ||
--- a/binutils/objdump.c | ||
+++ b/binutils/objdump.c | ||
@@ -116,7 +116,8 @@ static bool disassemble_all; /* -D */ | ||
static int disassemble_zeroes; /* --disassemble-zeroes */ | ||
static bool formats_info; /* -i */ | ||
int wide_output; /* -w */ | ||
-static int insn_width; /* --insn-width */ | ||
+#define MAX_INSN_WIDTH 49 | ||
+static unsigned long insn_width; /* --insn-width */ | ||
static bfd_vma start_address = (bfd_vma) -1; /* --start-address */ | ||
static bfd_vma stop_address = (bfd_vma) -1; /* --stop-address */ | ||
static int dump_debugging; /* --debugging */ | ||
@@ -3315,7 +3316,7 @@ disassemble_bytes (struct disassemble_info *inf, | ||
} | ||
else | ||
{ | ||
- char buf[50]; | ||
+ char buf[MAX_INSN_WIDTH + 1]; | ||
unsigned int bpc = 0; | ||
unsigned int pb = 0; | ||
|
||
@@ -5976,8 +5977,9 @@ main (int argc, char **argv) | ||
break; | ||
case OPTION_INSN_WIDTH: | ||
insn_width = strtoul (optarg, NULL, 0); | ||
- if (insn_width <= 0) | ||
- fatal (_("error: instruction width must be positive")); | ||
+ if (insn_width - 1 >= MAX_INSN_WIDTH) | ||
+ fatal (_("error: instruction width must be in the range 1 to " | ||
+ XSTRING (MAX_INSN_WIDTH))); | ||
break; | ||
case OPTION_INLINES: | ||
unwind_inlines = true; | ||
-- | ||
2.34.1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters