Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:MaxxedSUSE:Emulators
gdb
gdb-testsuite-fix-buffer-overflow-in-gdb.base-s...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File gdb-testsuite-fix-buffer-overflow-in-gdb.base-signed.patch of Package gdb
From 6c09d2d14f44ac92d2509973ff6da376c248510f Mon Sep 17 00:00:00 2001 From: Andrew Burgess <aburgess@redhat.com> Date: Tue, 20 Dec 2022 12:51:50 +0000 Subject: [PATCH 1/6] gdb/testsuite: fix buffer overflow in gdb.base/signed-builtin-types.exp In commit: commit 9f50fe0835850645bd8ea9bb1efe1fe6c48dfb12 Date: Wed Dec 7 15:55:25 2022 +0000 gdb/testsuite: new test for recent dwarf reader issue A new test (gdb.base/signed-builtin-types.exp) was added that made use of 'info sources' to figure out if the debug information for a particular object file had been fully expanded or not. Unfortunately some lines of the 'info sources' output can be very long, this was observed on some systems where the debug information for the dynamic-linker was installed, in this case, the list of source files associated with the dynamic linker was so long it would cause expect's internal buffer to overflow. This commit switches from using 'info sources' to 'maint print objfile', the output from the latter command is more compact, but also, can be restricted to a single named object file. With this change in place I am no longer seeing buffer overflow errors from expect when running gdb.base/signed-builtin-types.exp. --- .../gdb.base/signed-builtin-types.exp | 51 +++---------------- 1 file changed, 8 insertions(+), 43 deletions(-) diff --git a/gdb/testsuite/gdb.base/signed-builtin-types.exp b/gdb/testsuite/gdb.base/signed-builtin-types.exp index c7eee139c74..c4afc621cee 100644 --- a/gdb/testsuite/gdb.base/signed-builtin-types.exp +++ b/gdb/testsuite/gdb.base/signed-builtin-types.exp @@ -21,7 +21,8 @@ standard_testfile .c -lib.c # Compile the shared library. set srcdso [file join $srcdir $subdir $srcfile2] -set objdso [standard_output_file lib${gdb_test_file_name}.so] +set libname "lib${gdb_test_file_name}.so" +set objdso [standard_output_file $libname] if {[gdb_compile_shlib $srcdso $objdso {debug}] != ""} { untested "failed to compile dso" return -1 @@ -46,46 +47,10 @@ if {[readnow]} { # library has been fully expanded or not. Return true if the debug # information has NOT been fully expanded (which is what we want for this # test). -proc shared_library_debug_not_fully_expanded {} { - set library_expanded "" - gdb_test_multiple "info sources" "" { - -re "^info sources\r\n" { - exp_continue - } - -re "^(\[^\r\n\]+):\r\n\\(Full debug information has not yet been read for this file\\.\\)\r\n\r\n" { - set libname $expect_out(1,string) - if {$libname == $::objdso} { - set library_expanded "no" - } - exp_continue - } - -re "^(\[^\r\n\]+):\r\n\\(Objfile has no debug information\\.\\)\r\n\r\n" { - set libname $expect_out(1,string) - if {$libname == $::objdso} { - # For some reason the shared library has no debug - # information, this is not expected. - set library_expanded "missing debug" - } - exp_continue - } - -re "^(\[^\r\n\]+):\r\n\r\n" { - set libname $expect_out(1,string) - if {$libname == $::objdso} { - set library_expanded "yes" - } - exp_continue - } - -re "^$::gdb_prompt $" { - gdb_assert {[string equal $library_expanded "yes"] \ - || [string equal $library_expanded "no"]} \ - $gdb_test_name - } - -re "^(\[^\r\n:\]*)\r\n" { - exp_continue - } - } - - return [expr $library_expanded == "no"] +proc assert_shared_library_debug_not_fully_expanded {} { + gdb_test_lines "maint print objfiles $::libname" "" \ + "Object file \[^\r\n\]*$::libname" \ + -re-not "Symtabs:" } foreach_with_prefix type_name {"short" "int" "long" "char"} { @@ -93,7 +58,7 @@ foreach_with_prefix type_name {"short" "int" "long" "char"} { with_test_prefix "before sizeof expression" { # Check that the debug information for the shared library has # not yet been read in. - gdb_assert { [shared_library_debug_not_fully_expanded] } + assert_shared_library_debug_not_fully_expanded } # Evaluate a sizeof expression for a builtin type. At one point GDB @@ -106,7 +71,7 @@ foreach_with_prefix type_name {"short" "int" "long" "char"} { with_test_prefix "after sizeof expression" { # Check that the debug information for the shared library has not # yet been read in. - gdb_assert { [shared_library_debug_not_fully_expanded] } + assert_shared_library_debug_not_fully_expanded } } } base-commit: d5d2daa1efc67fdaaefe9648bb1275608779455d -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor