Skip to content

Commit

Permalink
load_value: Fix addr integer overflow. Close angr/angr#4533. (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
ltfish authored Mar 26, 2024
1 parent e4273b5 commit 95dbfc0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyvex_c/analysis.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,15 @@ Bool load_value(ULong addr, int size, int endness, void *value) {
return False;
}
unsigned char* ptr = NULL;
if (regions[pos].in_use && regions[pos].start <= addr &&
regions[pos].start + regions[pos].size >= addr + size) {
if (regions[pos].in_use &&
regions[pos].start <= addr &&
regions[pos].start <= addr + size &&
regions[pos].start + regions[pos].size >= addr + size) {
ptr = regions[pos].content + (addr - regions[pos].start);
} else if (pos > 0 &&
regions[pos - 1].in_use &&
regions[pos - 1].start <= addr &&
regions[pos - 1].start <= addr + size &&
regions[pos - 1].start + regions[pos - 1].size >= addr + size) {
ptr = regions[pos - 1].content + (addr - regions[pos - 1].start);
} else {
Expand Down

0 comments on commit 95dbfc0

Please sign in to comment.