public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "sihan2021 at iscas dot ac.cn" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/30706] New: dynamic-stack-buffer-overflow /home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/ada-lang.c:1391 in ada_decode[abi:cxx11](char const*, bool, bool)
Date: Mon, 31 Jul 2023 12:00:12 +0000	[thread overview]
Message-ID: <bug-30706-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=30706

            Bug ID: 30706
           Summary: dynamic-stack-buffer-overflow
                    /home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/ada-l
                    ang.c:1391 in ada_decode[abi:cxx11](char const*, bool,
                    bool)
           Product: gdb
           Version: 13.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: sihan2021 at iscas dot ac.cn
  Target Milestone: ---

Created attachment 15026
  --> https://sourceware.org/bugzilla/attachment.cgi?id=15026&action=edit
crash seed

Hello, developers of gdb, we recently ran some fuzz on gdb 13.1 and find a
stack-buffer-overflow  bug. Here is the description of this bug. I hope this
can accsit you to solve this bug.

Version:
gdb 13.1 (compile with ASAN) 
ubuntu 20.04

Command to reproduce:
gdb dsbo

ASAN report:
==3117258==ERROR: AddressSanitizer: dynamic-stack-buffer-overflow on address
0x7ffd4744605f at pc 0x55c23d0564a0 bp 0x7ffd47445bc0 sp 0x7ffd47445bb0
READ of size 1 at 0x7ffd4744605f thread T0
    #0 0x55c23d05649f in ada_decode[abi:cxx11](char const*, bool, bool)
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/ada-lang.c:1391
    #1 0x55c23d099aff in ada_language::sniff_from_mangled_name(char const*,
std::unique_ptr<char, gdb::xfree_deleter<char> >*) const
(/home/root/gdb/binutils-gdb-gdb-13.1-release/install/bin/gdb+0xba3aff)
    #2 0x55c23de773b7 in symbol_find_demangled_name(general_symbol_info*, char
const*) /home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symtab.c:892
    #3 0x55c23de77c84 in
general_symbol_info::compute_and_set_names(gdb::basic_string_view<char,
std::char_traits<char> >, bool, objfile_per_bfd_storage*,
gdb::optional<unsigned int>)
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symtab.c:980
    #4 0x55c23d3b7927 in process_coff_symbol
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/coffread.c:1572
    #5 0x55c23d3b55b0 in coff_symtab_read
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/coffread.c:1184
    #6 0x55c23d3b1da4 in coff_read_minsyms
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/coffread.c:554
    #7 0x55c23d3b2c07 in coff_symfile_read
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/coffread.c:703
    #8 0x55c23de3e421 in read_symbols
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:773
    #9 0x55c23de3f38a in syms_from_objfile_1
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:968
    #10 0x55c23de3f5f9 in syms_from_objfile
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:985
    #11 0x55c23de404f6 in symbol_file_add_with_addrs
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:1088
    #12 0x55c23de411fd in symbol_file_add_from_bfd(gdb::ref_ptr<bfd,
gdb_bfd_ref_policy> const&, char const*, enum_flags<symfile_add_flag>,
std::vector<other_sections, std::allocator<other_sections> >*,
enum_flags<objfile_flag>, objfile*)
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:1168
    #13 0x55c23de413a2 in symbol_file_add(char const*,
enum_flags<symfile_add_flag>, std::vector<other_sections,
std::allocator<other_sections> >*, enum_flags<objfile_flag>)
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:1181
    #14 0x55c23de4170c in symbol_file_add_main_1
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:1205
    #15 0x55c23de41558 in symbol_file_add_main(char const*,
enum_flags<symfile_add_flag>)
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symfile.c:1196
    #16 0x55c23d9cb8cf in symbol_file_add_main_adapter
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/main.c:540
    #17 0x55c23d9cb6bf in catch_command_errors
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/main.c:513
    #18 0x55c23d9ce58a in captured_main_1
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/main.c:1213
    #19 0x55c23d9cf48f in captured_main
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/main.c:1320
    #20 0x55c23d9cf530 in gdb_main(captured_main_args*)
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/main.c:1345
    #21 0x55c23cff8eb1 in main
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/gdb.c:32
    #22 0x7f08cb9e3082 in __libc_start_main ../csu/libc-start.c:308
    #23 0x55c23cff8c8d in _start
(/home/root/gdb/binutils-gdb-gdb-13.1-release/install/bin/gdb+0xb02c8d)

Address 0x7ffd4744605f is located in stack of thread T0 at offset 191 in frame
    #0 0x55c23de7712e in symbol_find_demangled_name(general_symbol_info*, char
const*) /home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/symtab.c:872

  This frame has 1 object(s):
    [32, 40) 'demangled' (line 873) <== Memory access at offset 191 overflows
this variable
HINT: this may be a false positive if your program uses some custom stack
unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: dynamic-stack-buffer-overflow
/home/root/gdb/binutils-gdb-gdb-13.1-release/gdb/ada-lang.c:1391 in
ada_decode[abi:cxx11](char const*, bool, bool)
Shadow bytes around the buggy address:
  0x100028e80bb0: f2 f2 f2 f2 00 00 00 00 f2 f2 f2 f2 00 00 00 00
  0x100028e80bc0: f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
  0x100028e80bd0: 00 00 00 00 f1 f1 f1 f1 00 00 00 00 f3 f3 f3 f3
  0x100028e80be0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100028e80bf0: 00 00 00 00 f1 f1 f1 f1 00 f3 f3 f3 00 00 00 00
=>0x100028e80c00: 00 00 00 00 00 00 00 00 ca ca ca[ca]03 cb cb cb
  0x100028e80c10: cb cb cb cb 00 00 00 00 00 00 00 00 00 00 00 00
  0x100028e80c20: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
  0x100028e80c30: f1 f1 f8 f2 00 f2 f2 f2 00 f2 f2 f2 00 00 f2 f2
  0x100028e80c40: f8 f8 f2 f2 00 00 f2 f2 00 00 f2 f2 00 00 f2 f2
  0x100028e80c50: 00 00 00 00 f3 f3 f3 f3 00 00 00 00 00 00 00 00

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2023-07-31 12:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31 12:00 sihan2021 at iscas dot ac.cn [this message]
2023-08-01 15:10 ` [Bug gdb/30706] " tromey at sourceware dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30706-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).