binutils: add fix for CVE-2022-38533 (heap buffer-overflow in strip).
From upstream commit log: PR29482 - strip: heap-buffer-overflow PR 29482 * coffcode.h (coff_set_section_contents): Sanity check _LIB.
This commit is contained in:
parent
0a7b6c018e
commit
1e709f0a64
@ -1,6 +1,7 @@
|
||||
COMMENT = GNU binary utilities
|
||||
|
||||
DISTNAME = binutils-2.39
|
||||
REVISION = 0
|
||||
|
||||
CATEGORIES = devel
|
||||
|
||||
|
23
devel/binutils/patches/patch-bfd_coffcode_h
Normal file
23
devel/binutils/patches/patch-bfd_coffcode_h
Normal file
@ -0,0 +1,23 @@
|
||||
Fix for CVE-2022-38533: heap buffer overflow in strip (Binutils PR29482).
|
||||
|
||||
Upstream commit ef186fe54aa6d281a3ff8a9528417e5cc614c797.
|
||||
|
||||
Index: bfd/coffcode.h
|
||||
--- bfd/coffcode.h.orig
|
||||
+++ bfd/coffcode.h
|
||||
@@ -4284,10 +4284,13 @@ coff_set_section_contents (bfd * abfd,
|
||||
|
||||
rec = (bfd_byte *) location;
|
||||
recend = rec + count;
|
||||
- while (rec < recend)
|
||||
+ while (recend - rec >= 4)
|
||||
{
|
||||
+ size_t len = bfd_get_32 (abfd, rec);
|
||||
+ if (len == 0 || len > (size_t) (recend - rec) / 4)
|
||||
+ break;
|
||||
+ rec += len * 4;
|
||||
++section->lma;
|
||||
- rec += bfd_get_32 (abfd, rec) * 4;
|
||||
}
|
||||
|
||||
BFD_ASSERT (rec == recend);
|
Loading…
Reference in New Issue
Block a user