This is the mail archive of the
gdb-testers@sourceware.org
mailing list for the GDB project.
[binutils-gdb/gdb-8.3-branch] Avoid a crash in source_cache::extract_lines
- From: sergiodj+buildbot at sergiodj dot net
- To: gdb-testers at sourceware dot org
- Date: Thu, 14 Mar 2019 09:08:16 -0400
- Subject: [binutils-gdb/gdb-8.3-branch] Avoid a crash in source_cache::extract_lines
*** TEST RESULTS FOR COMMIT 655aeea04784cdc3e4dfbc0801e7be56f9a1ec11 ***
Author: Tom Tromey <tromey@adacore.com>
Branch: gdb-8.3-branch
Commit: 655aeea04784cdc3e4dfbc0801e7be56f9a1ec11
Avoid a crash in source_cache::extract_lines
If the first requested line is larger than the number of lines in the
source buffer, source_cache::extract_lines could crash, because it
would try to pass string::npos" to string::substr.
This patch avoids the crash by checking for this case.
This version of the patch changes get_source_lines to return
std::string.
2019-03-14 Tom Tromey <tromey@adacore.com>
* source-cache.h (class source_cache) <get_source_lines>: Return
std::string.
* source-cache.c (source_cache::extract_lines): Handle case where
first_pos==npos. Return std::string.
(source_cache::get_source_lines): Update.
- Follow-Ups:
- Failures on RHEL-s390x-m64, branch gdb-8.3-branch
- Failures on Debian-s390x-native-extended-gdbserver-m64, branch gdb-8.3-branch
- Failures on Debian-s390x-native-gdbserver-m64, branch gdb-8.3-branch
- Failures on Debian-s390x-m64, branch gdb-8.3-branch
- Failures on Fedora-i686, branch gdb-8.3-branch
- Failures on Fedora-x86_64-cc-with-index, branch gdb-8.3-branch
- Failures on Fedora-x86_64-native-extended-gdbserver-m64, branch gdb-8.3-branch
- Failures on Fedora-x86_64-m64, branch gdb-8.3-branch
- Failures on Fedora-x86_64-native-extended-gdbserver-m32, branch gdb-8.3-branch
- Failures on Fedora-x86_64-native-gdbserver-m64, branch gdb-8.3-branch
- Failures on Fedora-x86_64-m32, branch gdb-8.3-branch
- Failures on Fedora-x86_64-native-gdbserver-m32, branch gdb-8.3-branch