fprintf (file, ", unknown(%u))", info);
break;
default:
- /* Already caught by the previous scan. */
- abort ();
+ /* PR 17512: file: 2245-7442-0.004. */
+ fprintf (file, _("Unknown: %x"), PEX64_UNWCODE_CODE (dta[1]));
+ break;
}
if (unexpected)
fprintf (file, " [Unexpected!]");
bfd_vma vaddr;
bfd_vma end_addr;
bfd_vma addr = rf->rva_UnwindData;
+ bfd_size_type sec_size = xdata_section->rawsize > 0 ? xdata_section->rawsize : xdata_section->size;
struct pex64_unwind_info ui;
vaddr = xdata_section->vma - pe_data (abfd)->pe_opthdr.ImageBase;
addr -= vaddr;
+ /* PR 17512: file: 2245-7442-0.004. */
+ if (addr >= sec_size)
+ {
+ fprintf (file, _("warning: xdata section corrupt\n"));
+ return;
+ }
+
if (endx)
- end_addr = endx[0] - vaddr;
+ {
+ end_addr = endx[0] - vaddr;
+ /* PR 17512: file: 2245-7442-0.004. */
+ if (end_addr > sec_size)
+ {
+ fprintf (file, _("warning: xdata section corrupt"));
+ end_addr = sec_size;
+ }
+ }
else
- end_addr = (xdata_section->rawsize != 0 ?
- xdata_section->rawsize : xdata_section->size);
-
+ end_addr = sec_size;
pex64_get_unwind_info (abfd, &ui, &xdata[addr]);
-
+
if (ui.Version != 1 && ui.Version != 2)
{
unsigned int i;
ui.FrameRegister == 0 ? "none"
: pex_regs[(unsigned int) ui.FrameRegister]);
- pex64_xdata_print_uwd_codes (file, abfd, &ui, rf);
+ /* PR 17512: file: 2245-7442-0.004. */
+ if (ui.CountOfCodes * 2 + ui.rawUnwindCodes + addr >= xdata + xdata_section->size)
+ fprintf (file, _("Too many unwind codes (%ld)\n"), (long) ui.CountOfCodes);
+ else
+ pex64_xdata_print_uwd_codes (file, abfd, &ui, rf);
switch (ui.Flags)
{
if (i + PDATA_ROW_SIZE > stop)
break;
+
pex64_get_runtime_function (abfd, &rf, &pdata[i]);
if (rf.rva_BeginAddress == 0 && rf.rva_EndAddress == 0
identical pointers in the array; advance past all of them. */
while (p[0] <= rf.rva_UnwindData)
++p;
+
if (p[0] == ~((bfd_vma) 0))
p = NULL;