Skip to content

Commit

Permalink
Merge pull request #4273 from bylaws/earlyend
Browse files Browse the repository at this point in the history
Frontend: End multiblocks early after hitting 2 consecutive null bytes
  • Loading branch information
alyssarosenzweig authored Jan 14, 2025
2 parents a52dd71 + 6437508 commit 48c03d7
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions FEXCore/Source/Interface/Core/Frontend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,12 @@ void Decoder::DecodeInstructionsAtEntry(const uint8_t* _InstStream, uint64_t PC,
auto OpMinPage = OpMinAddress & FEXCore::Utils::FEX_PAGE_MASK;
auto OpMaxPage = OpMaxAddress & FEXCore::Utils::FEX_PAGE_MASK;

if (!EntryBlock && OpMinPage == OpMaxPage && PeekByte(0) == 0 && PeekByte(1) == 0) [[unlikely]] {
// End the multiblock early if we hit 2 consecutive null bytes (add [rax], al) in the same page with the
// assumption we are most likely trying to explore garbage code.
break;
}

if (OpMinPage != CurrentCodePage) {
CurrentCodePage = OpMinPage;
CodePages.insert(CurrentCodePage);
Expand Down

0 comments on commit 48c03d7

Please sign in to comment.