diff options
author | Hannes Domani <ssbssa@yahoo.de> | 2024-08-06 19:34:18 +0200 |
---|---|---|
committer | Hannes Domani <ssbssa@yahoo.de> | 2024-08-06 19:36:25 +0200 |
commit | 8fdd2b2bcd8117cafcc6ef976e45f0d9f95fb528 (patch) | |
tree | c9b099c4262698bb1ca583ff1494090cae00c561 /zlib/README | |
parent | bb07e97d25b33d8cdcce5238bc0e292308bf570d (diff) | |
download | gdb-8fdd2b2bcd8117cafcc6ef976e45f0d9f95fb528.zip gdb-8fdd2b2bcd8117cafcc6ef976e45f0d9f95fb528.tar.gz gdb-8fdd2b2bcd8117cafcc6ef976e45f0d9f95fb528.tar.bz2 |
Mark unavailable bytes of limited-length arrays when allocating contents
Using 'output' to print arrays larger than max-value-size, with only
repeating elements, can cause gdb to crash:
```
$ cat a.c:
char a[1000000];
int main()
{
return a[0];
}
$ gdb -q a
(gdb) print a
$1 = {0 '\000' <repeats 65536 times>, <unavailable> <repeats 934464 times>}
(gdb) output a
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
```
Using 'print' works, because value::record_latest sets the unavailable
bytes of the value when it's added to the value history.
But 'outout' doesn't do that, so the printing tries to access more bytes
than are available.
The original problem in PR32015 was about using 'print' of a dynamic
array in a D program.
Here the crash happens because for 'print' the value was a struct with
length/ptr fields, which is converted in d-valprint.c into an array.
So value::record_latest didn't have a chance to mark the unavailable
bytes in this case.
To make sure the unavailable bytes always match the contents, this fixes
it by marking the unavailable bytes immediately after the contents are
allocated.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32015
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
Diffstat (limited to 'zlib/README')
0 files changed, 0 insertions, 0 deletions