diff options
author | Andrew Burgess <aburgess@broadcom.com> | 2013-07-16 21:12:14 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@broadcom.com> | 2013-07-16 21:12:14 +0000 |
commit | 5ea5559b9aab3618955d6d38934828e9d5749bea (patch) | |
tree | 9aa1ffc18e57611494e73af7b6685a96860667de /gdb/testsuite/gdb.base/printcmds.exp | |
parent | 2c57100624571d93ebc965bed32b7d517a382e02 (diff) | |
download | gdb-5ea5559b9aab3618955d6d38934828e9d5749bea.zip gdb-5ea5559b9aab3618955d6d38934828e9d5749bea.tar.gz gdb-5ea5559b9aab3618955d6d38934828e9d5749bea.tar.bz2 |
Check for NULL character before calling strchr.
http://sourceware.org/ml/gdb-patches/2013-07/msg00322.html
gdb/ChangeLog
* common/format.c (parse_format_string): Add checks for NULL
character before calling strchr.
gdb/testsuite/ChangeLog
* gdb.base/printcmds.exp (test_printf): Add tests for format
strings with missing format specifier.
Diffstat (limited to 'gdb/testsuite/gdb.base/printcmds.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/printcmds.exp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/printcmds.exp b/gdb/testsuite/gdb.base/printcmds.exp index 0597ab0..0c06557 100644 --- a/gdb/testsuite/gdb.base/printcmds.exp +++ b/gdb/testsuite/gdb.base/printcmds.exp @@ -718,6 +718,12 @@ proc test_printf {} { # Regression test for "%% at end of format string. # See http://sourceware.org/bugzilla/show_bug.cgi?id=11345 gdb_test "printf \"%%%d%%\\n\", 5" "%5%" + + # Some tests for missing format specifier after '%'. + gdb_test "printf \"%\", 0" "Incomplete format specifier at end of format string" + gdb_test "printf \"%.234\", 0" "Incomplete format specifier at end of format string" + gdb_test "printf \"%-\", 0" "Incomplete format specifier at end of format string" + gdb_test "printf \"%-23\", 0" "Incomplete format specifier at end of format string" } #Test printing DFP values with printf |