diff options
author | Nick Clifton <nickc@redhat.com> | 2021-11-24 17:02:02 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2021-11-24 17:02:02 +0000 |
commit | d8ed269e5c875845fcd0f1a25457eafe3f485249 (patch) | |
tree | 9a8dc0981bf76f908a9808a76dd6fe461a215130 /binutils | |
parent | 5e97696c113e8ffa93e12df22e0d34c6984cc383 (diff) | |
download | gdb-d8ed269e5c875845fcd0f1a25457eafe3f485249.zip gdb-d8ed269e5c875845fcd0f1a25457eafe3f485249.tar.gz gdb-d8ed269e5c875845fcd0f1a25457eafe3f485249.tar.bz2 |
Fix an illegal memory access parsing a corrupt sysroff file.
PR 28564
* sysdump.c (getCHARS): Check for an out of bounds read.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/sysdump.c | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 8d2f041..cc742ec 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2021-11-24 Nick Clifton <nickc@redhat.com> + + PR 28564 + * sysdump.c (getCHARS): Check for an out of bounds read. + 2021-11-16 Fangrui Song <maskray@google.com> * readelf.c (enum relocation_type): New. diff --git a/binutils/sysdump.c b/binutils/sysdump.c index 35796e8..3aa046f 100644 --- a/binutils/sysdump.c +++ b/binutils/sysdump.c @@ -60,6 +60,12 @@ getCHARS (unsigned char *ptr, int *idx, int size, int max) (*idx) += 8; } + if (oc + b > size) + { + /* PR 28564 */ + return _("*corrupt*"); + } + *idx += b * 8; r = xcalloc (b + 1, 1); memcpy (r, ptr + oc, b); |