public inbox for binutils-cvs@sourceware.org
 help / color / mirror / Atom feed
* [binutils-gdb] Fix an illegal memory access when parsing a corrupt VMS Alpha file.
@ 2022-12-05 11:12 Nick Clifton
  0 siblings, 0 replies; only message in thread
From: Nick Clifton @ 2022-12-05 11:12 UTC (permalink / raw)
  To: bfd-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=942fa4fb32738ecbb447546d54f1e5f0312d2ed4

commit 942fa4fb32738ecbb447546d54f1e5f0312d2ed4
Author: Nick Clifton <nickc@redhat.com>
Date:   Mon Dec 5 11:11:44 2022 +0000

    Fix an illegal memory access when parsing a corrupt VMS Alpha file.
    
            PR 29848
            * vms-alpha.c (parse_module): Fix potential out of bounds memory
            access.

Diff:
---
 bfd/ChangeLog   | 6 ++++++
 bfd/vms-alpha.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index eee5d42d6bb..ee8eaf01d42 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2022-12-05  Nick Clifton  <nickc@redhat.com>
+
+	PR 29848
+	* vms-alpha.c (parse_module): Fix potential out of bounds memory
+	access.
+
 2022-12-01  Nick Clifton  <nickc@redhat.com>
 
 	PR 25202
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index 9531953bb6d..c0eb5bc5a2a 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -4366,7 +4366,7 @@ parse_module (bfd *abfd, struct module *module, unsigned char *ptr,
     return false;
   module->line_table = curr_line;
 
-  while (length == -1 || ptr < maxptr)
+  while (length == -1 || (ptr + 3) < maxptr)
     {
       /* The first byte is not counted in the recorded length.  */
       int rec_length = bfd_getl16 (ptr) + 1;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-12-05 11:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-05 11:12 [binutils-gdb] Fix an illegal memory access when parsing a corrupt VMS Alpha file Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).