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.