public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] libiberty: prevent buffer overflow when decoding user input
@ 2021-09-22  1:10 Luís Ferreira
  2021-09-23 10:16 ` ibuclaw
  0 siblings, 1 reply; 15+ messages in thread
From: Luís Ferreira @ 2021-09-22  1:10 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 810 bytes --]

Currently a stack/heap overflow may happen if a crafted mangle is
maliciously used to cause denial of service, such as intentional
crashes
by accessing a reserved memory space.

Signed-off-by: Luís Ferreira <contact@lsferreira.net>
---
 libiberty/d-demangle.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c
index a2152cc65518..7ded3e2a2563 100644
--- a/libiberty/d-demangle.c
+++ b/libiberty/d-demangle.c
@@ -381,7 +381,7 @@ dlang_symbol_backref (string *decl, const char
*mangled,
 
   /* Must point to a simple identifier.  */
   backref = dlang_number (backref, &len);
-  if (backref == NULL)
+  if (backref == NULL || strlen(backref) < len)
     return NULL;
 
   backref = dlang_lname (decl, backref, len);



[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-10-12 20:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22  1:10 [PATCH] libiberty: prevent buffer overflow when decoding user input Luís Ferreira
2021-09-23 10:16 ` ibuclaw
2021-09-23 15:40   ` Luís Ferreira
2021-09-23 15:50   ` Jeff Law
2021-10-04 16:52     ` Luís Ferreira
2021-10-05 15:00       ` Jeff Law
2021-10-05 17:26         ` Luís Ferreira
2021-10-06  1:49           ` Eric Gallager
2021-10-07 18:29             ` Luís Ferreira
2021-10-08 16:52               ` Iain Buclaw
2021-10-08 17:08                 ` Luís Ferreira
2021-10-08 20:11                   ` Iain Buclaw
2021-10-12 12:54                     ` Luís Ferreira
2021-10-12 19:40                       ` Eric Gallager
2021-10-12 20:25                         ` Luís Ferreira

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).