Fixed incorrect ".debug_abbrev" section termination

Incorrect terminataion of the section causes GDB to read after the end of
the section This leads to unpredictable behavior (dwarf warnings, etc).
The problem is well visible when runing GDB under VALGRIND.

$ valgrind gdb --args luajit test.lua
(gdb) r

The affected GDB code

https://github.com/bminor/binutils-gdb/blob/master/gdb/dwarf2/abbrev.c#L138
This commit is contained in:
Dmitry Stogov 2023-12-07 00:16:28 +03:00
parent 43d0a19158
commit 52e845d99f

View File

@ -637,7 +637,7 @@ static void LJ_FASTCALL gdbjit_debugabbrev(GDBJITctx *ctx)
DUV(DW_AT_low_pc); DUV(DW_FORM_addr); DUV(DW_AT_low_pc); DUV(DW_FORM_addr);
DUV(DW_AT_high_pc); DUV(DW_FORM_addr); DUV(DW_AT_high_pc); DUV(DW_FORM_addr);
DUV(DW_AT_stmt_list); DUV(DW_FORM_data4); DUV(DW_AT_stmt_list); DUV(DW_FORM_data4);
DB(0); DB(0); DB(0); DB(0); DB(0);
ctx->p = p; ctx->p = p;
} }