Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out-of-bounds access in FixOpSizeForMemoryOperand #38

Open
0vercl0k opened this issue Jan 16, 2022 · 0 comments
Open

Out-of-bounds access in FixOpSizeForMemoryOperand #38

0vercl0k opened this issue Jan 16, 2022 · 0 comments

Comments

@0vercl0k
Copy link
Contributor

Hello,

I'm hitting an OOB read access in the below code:

void __bea_callspec__ FixOpSizeForMemoryOperand (PDISASM pMyDisasm)
{
  int i = GV.MemDecoration / 100;
  if (ArgsSize[GV.MemDecoration - (i*100+1)] != 0) {

Basically, the following arithmetic GV.MemDecoration - (i*100+1) is equal to -1 which makes it access 4 bytes before the array:

0:004> ?? pMyDisasm->Reserved_.MemDecoration
int 0n0
0:004> ?? i
int 0n0

This has been caught using address-sanitizer on Windows:

=================================================================
==16444==ERROR: AddressSanitizer: global-buffer-overflow on address 0x7ff67bf4dbfc at pc 0x7ff67bbd3a36 bp 0x002bd7cfd680 sp 0x002bd7cfd688
READ of size 4 at 0x7ff67bf4dbfc thread T16777215
    #0 0x7ff67bbd3a35 in FixOpSizeForMemoryOperand C:\work\codes\rp\src\third_party\beaengine\src\Includes\Routines_Disasm.c:192
    #1 0x7ff67bce538d in Disasm C:\work\codes\rp\src\third_party\beaengine\src\Includes\Routines_Disasm.c:35
    #2 0x7ff67ba75cfd in IntelBeaEngine::disass(unsigned char const *, unsigned __int64, unsigned __int64, enum DisassEngineReturn &) C:\work\codes\rp\src\rp\intelbeaengine.hpp:28

Cheers

0vercl0k added a commit to 0vercl0k/rp that referenced this issue Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant