diff options
author | Luis Machado <luis.machado@linaro.org> | 2020-08-12 17:02:32 -0300 |
---|---|---|
committer | Luis Machado <luis.machado@linaro.org> | 2020-08-12 17:02:32 -0300 |
commit | 6d8a0a5e90936d4bea9bf1ce9b4e1c22d9aaccae (patch) | |
tree | 1a1c7c7956a97bd002fde51577b5792b7e91ae63 /cpu | |
parent | 7cf663a9321e2fc4f4e3316eab77bdd0b21ab4af (diff) | |
download | gdb-6d8a0a5e90936d4bea9bf1ce9b4e1c22d9aaccae.zip gdb-6d8a0a5e90936d4bea9bf1ce9b4e1c22d9aaccae.tar.gz gdb-6d8a0a5e90936d4bea9bf1ce9b4e1c22d9aaccae.tar.bz2 |
Fix malloc allocation size sanity check
During debugging of PR26362, it was noticed that the malloc size check
in check_type_length_before_alloc wasn't detecting an allocation attempt
of a huge amount of bytes, making GDB run into an internal error.
This happens because we're using an int to store a type's length. When the
type length is large enough, the int will overflow and the max_value_size
check won't work anymore.
The following patch fixes this by making the length variable a ULONGEST.
Printing statements were also updated to show the correct number of bytes.
gdb/ChangeLog:
2020-08-12 Luis Machado <luis.machado@linaro.org>
* value.c (check_type_length_before_alloc): Use ULONGEST to store a
type's length.
Use %s and pulongest to print the length.
Diffstat (limited to 'cpu')
0 files changed, 0 insertions, 0 deletions