dwfl_segment_report_module might otherwise try to handle half a phdr
taking the other half from after the buffer.
Signed-off-by: Mark Wielaard <mark@klomp.org>
2021-12-08 Mark Wielaard <mark@klomp.org>
+ * dwfl_segment_report_module.c (dwfl_segment_report_module): Make sure
+ that ph_buffer_size has room for at least one phdr.
+
+2021-12-08 Mark Wielaard <mark@klomp.org>
+
* dwfl_segment_report_module.c (dwfl_segment_report_module): Make
sure the note len increases each iteration.
buffer, otherwise it will be the size of the new buffer that
could be read. */
if (ph_buffer_size != 0)
- xlatefrom.d_size = ph_buffer_size;
+ {
+ phnum = ph_buffer_size / phentsize;
+ if (phnum == 0)
+ goto out;
+ xlatefrom.d_size = ph_buffer_size;
+ }
xlatefrom.d_buf = ph_buffer;