From b9159ddee8f8f293a1e345fb57f773434b151f68 Mon Sep 17 00:00:00 2001 From: "Dr. Chat" Date: Wed, 16 Dec 2015 14:48:42 -0600 Subject: [PATCH] X64CodeCache: Add a couple of overflow debug asserts --- src/xenia/cpu/backend/x64/x64_code_cache_win.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/xenia/cpu/backend/x64/x64_code_cache_win.cc b/src/xenia/cpu/backend/x64/x64_code_cache_win.cc index 84df03a05..068bfa661 100644 --- a/src/xenia/cpu/backend/x64/x64_code_cache_win.cc +++ b/src/xenia/cpu/backend/x64/x64_code_cache_win.cc @@ -126,6 +126,8 @@ Win32X64CodeCache::RequestUnwindReservation(uint8_t* entry_address) { unwind_reservation.data_size = xe::round_up(kUnwindInfoSize, 16); unwind_reservation.table_slot = ++unwind_table_count_; unwind_reservation.entry_address = entry_address; + assert_false(unwind_table_count_ >= kMaximumFunctionCount); + return unwind_reservation; } @@ -259,6 +261,8 @@ void Win32X64CodeCache::InitializeUnwindEntry(uint8_t* unwind_entry_address, 7; // end of instruction + 1 == offset of next instruction unwind_code.UnwindOp = UWOP_ALLOC_LARGE; unwind_code.OpInfo = 0; + + assert_true((stack_size / 8) < 65536u); unwind_code = unwind_info->UnwindCode[co++]; unwind_code.FrameOffset = (USHORT)(stack_size) / 8; }