From: Hannes Domani Date: Fri, 15 Apr 2022 18:28:13 +0000 (+0200) Subject: Fix overflow when reading the exception directory X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=020fd79ff7faa65e33d357f51299a60de3f12288;p=thirdparty%2Fbinutils-gdb.git Fix overflow when reading the exception directory --- diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c index eca94f2ea7c..3c86ec63319 100644 --- a/gdb/amd64-windows-tdep.c +++ b/gdb/amd64-windows-tdep.c @@ -1033,7 +1033,7 @@ amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc, lo = 0; hi = dir->Size / sizeof (struct external_pex64_runtime_function); *unwind_info = 0; - while (lo <= hi) + while (lo < hi) { unsigned long mid = lo + (hi - lo) / 2; struct external_pex64_runtime_function d; @@ -1046,7 +1046,7 @@ amd64_windows_find_unwind_info (struct gdbarch *gdbarch, CORE_ADDR pc, sa = extract_unsigned_integer (d.rva_BeginAddress, 4, byte_order); ea = extract_unsigned_integer (d.rva_EndAddress, 4, byte_order); if (pc < base + sa) - hi = mid - 1; + hi = mid; else if (pc >= base + ea) lo = mid + 1; else if (pc >= base + sa && pc < base + ea)