Skip to content

Commit

Permalink
Weak use of filtered array could cause undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jul 1, 2024
1 parent a0fdc39 commit 3c47f29
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/agent/lib/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,14 @@ export function listSegmentsJson(args: string[]) {
baseAddr = ptr(args[0]);
} else {
const here = ptr(r2frida.offset);
baseAddr = Process.enumerateModules()
bases = Process.enumerateModules()
.filter(m => here.compare(m.base) >= 0 && here.compare(m.base.add(m.size)) < 0)
.map(m => m.base)[0];
.map(m => m.base);
if (bases.length > 0) {
baseAddr = bases[0];
} else {
throw new Error('Cannot find base address');
}
}
return listElfSegments(baseAddr);
}
Expand Down

0 comments on commit 3c47f29

Please sign in to comment.