* Assertion failure dumping .eh_frame_hdr
@ 2024-01-26 6:48 Alan Modra
0 siblings, 0 replies; only message in thread
From: Alan Modra @ 2024-01-26 6:48 UTC (permalink / raw)
To: binutils
dwarf.c can hit "Assertion '(start) <= (end)' failed" on truncated
sections, due to get_encoded_eh_value wrongly returning a full count
for truncated words.
* dwarf.c (get_encoded_eh_value): Return zero for truncated words.
diff --git a/binutils/dwarf.c b/binutils/dwarf.c
index a30bc1cb9ab..1947ab180ee 100644
--- a/binutils/dwarf.c
+++ b/binutils/dwarf.c
@@ -9236,37 +9236,37 @@ get_encoded_eh_value (unsigned int encoding,
case DW_EH_PE_udata2:
old_start = start;
SAFE_BYTE_GET_AND_INC (val, start, 2, end);
- len = (start == old_start) ? 0 : 2;
+ len = start - old_start == 2 ? 2 : 0;
break;
case DW_EH_PE_udata4:
old_start = start;
SAFE_BYTE_GET_AND_INC (val, start, 4, end);
- len = (start == old_start) ? 0 : 4;
+ len = start - old_start == 4 ? 4 : 0;
break;
case DW_EH_PE_udata8:
old_start = start;
SAFE_BYTE_GET_AND_INC (val, start, 8, end);
- len = (start == old_start) ? 0 : 8;
+ len = start - old_start == 8 ? 8 : 0;
break;
case DW_EH_PE_sdata2:
old_start = start;
SAFE_SIGNED_BYTE_GET_AND_INC (val, start, 2, end);
- len = (start == old_start) ? 0 : 2;
+ len = start - old_start == 2 ? 2 : 0;
break;
case DW_EH_PE_sdata4:
old_start = start;
SAFE_SIGNED_BYTE_GET_AND_INC (val, start, 4, end);
- len = (start == old_start) ? 0 : 4;
+ len = start - old_start == 4 ? 4 : 0;
break;
case DW_EH_PE_sdata8:
old_start = start;
SAFE_SIGNED_BYTE_GET_AND_INC (val, start, 8, end);
- len = (start == old_start) ? 0 : 8;
+ len = start - old_start == 8 ? 8 : 0;
break;
default:
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-01-26 6:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-26 6:48 Assertion failure dumping .eh_frame_hdr Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).