This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix for pr16196: Honor fetch limit for strings of known size


On Fri, Nov 22, 2013 at 12:02 PM, Sterling Augustine
<saugustine@google.com> wrote:
> The enclosed patch fixes 16196, which was revealed when an unitialized
> C++ string happened to point to valid memory and had a garbage in the
> size field that happened to look very large. GDB then spins a very
> long time reading invalid memory.
>
> The patch fixes this by enforcing the fetch limit (which, in turn, is
> set by print elements) even when the size of the string is known. This
> makes the function's behavior similar to when the size of the string
> isn't know.
>
> I checked all callers, and it this does not cause any difference in
> behavior, and reveals no new problems in the test-suite.
>
> Thanks
>
> Sterling
>
> 2013-11-22  Sterling Augustine  <saugustine@google.com>
>
>      PR backtrace/16196:
>      * valprint.c (read_string): Set new variable fetchlen based on
>      fetchlimit and size.  Use it in call to partial_memory_read.
>      Update comment.

LGTM.
[There are still other issues, but this patch doesn't have to fix all of them.]

I'd change the "backtrace" in backtrace/16196 to something else, not
sure what though.
"gdb" is always a good fallback.  PR gdb/16196.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]