diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index 52a84efd..c7541ab7 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -2046,6 +2046,9 @@ unsigned PackLinuxElf32::elf_find_table_size(unsigned dt_type, unsigned sh_type) unsigned x_rva; if (dt_type < DT_NUM) { unsigned const x_ndx = dt_table[dt_type]; + if (!x_ndx) { // no such entry + return 0; + } x_rva = get_te32(&dynseg[-1+ x_ndx].d_val); } else { @@ -7935,6 +7938,9 @@ unsigned PackLinuxElf64::elf_find_table_size(unsigned dt_type, unsigned sh_type) unsigned x_rva; if (dt_type < DT_NUM) { unsigned const x_ndx = dt_table[dt_type]; + if (!x_ndx) { // no such entry + return 0; + } x_rva = get_te64(&dynseg[-1+ x_ndx].d_val); } else {