aboutsummaryrefslogtreecommitdiff
path: root/binutils/dwarf.h
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2023-04-19 23:16:47 +0930
committerAlan Modra <amodra@gmail.com>2023-04-20 09:03:53 +0930
commit329dd2b6fcad4b3f1c4b0d443381f7c68ef18a9f (patch)
tree94b26ed119aad030db011e3a58711a7e928c1740 /binutils/dwarf.h
parent3b37f0f1b86cc1fb3ba9cc6d89695109db7f829a (diff)
downloadfsf-binutils-gdb-329dd2b6fcad4b3f1c4b0d443381f7c68ef18a9f.zip
fsf-binutils-gdb-329dd2b6fcad4b3f1c4b0d443381f7c68ef18a9f.tar.gz
fsf-binutils-gdb-329dd2b6fcad4b3f1c4b0d443381f7c68ef18a9f.tar.bz2
ubsan: signed integer overflow in display_debug_lines_raw
This one was caused by me unnecessarily promoting an "int adv" to "int64_t adv". The expression overflowing was 4259 + 9223372036854775807 with the left number being unsigned int. * dwarf.h (DWARF2_Internal_LineInfo): Replace unsigned short with uint16_t and unsigned char with uint8_t. Make li_line_base an int8_t. * dwarf.c (display_debug_lines_raw): Revert "adv" back to an int.
Diffstat (limited to 'binutils/dwarf.h')
-rw-r--r--binutils/dwarf.h25
1 files changed, 13 insertions, 12 deletions
diff --git a/binutils/dwarf.h b/binutils/dwarf.h
index 38fb6b7..d2f9523 100644
--- a/binutils/dwarf.h
+++ b/binutils/dwarf.h
@@ -23,18 +23,19 @@
/* Structure found in the .debug_line section. */
typedef struct
{
- uint64_t li_length;
- unsigned short li_version;
- unsigned char li_address_size;
- unsigned char li_segment_size;
- uint64_t li_prologue_length;
- unsigned char li_min_insn_length;
- unsigned char li_max_ops_per_insn;
- unsigned char li_default_is_stmt;
- int li_line_base;
- unsigned char li_line_range;
- unsigned char li_opcode_base;
- unsigned int li_offset_size;
+ uint64_t li_length;
+ uint16_t li_version;
+ uint8_t li_address_size;
+ uint8_t li_segment_size;
+ uint64_t li_prologue_length;
+ uint8_t li_min_insn_length;
+ uint8_t li_max_ops_per_insn;
+ uint8_t li_default_is_stmt;
+ int8_t li_line_base;
+ uint8_t li_line_range;
+ uint8_t li_opcode_base;
+ /* Not part of the header. 4 for 32-bit dwarf, 8 for 64-bit. */
+ unsigned int li_offset_size;
}
DWARF2_Internal_LineInfo;