Skip to content

Commit

Permalink
Fix #10296 - Heap out of bounds read in java_switch_op()
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Jun 11, 2018
1 parent c488aaa commit 224e6bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libr/anal/p/anal_java.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,11 @@ static int java_switch_op(RAnal *anal, RAnalOp *op, ut64 addr, const ut8 *data,

if (op_byte == 0xaa) {
// handle a table switch condition
if (pos + 8 > len) {
if (pos + 8 + 8 > len) {
return op->size;
}
int min_val = (ut32)(UINT (data, pos + 4)),
max_val = (ut32)(UINT (data, pos + 8));
const int min_val = (ut32)(UINT (data, pos + 4));
const int max_val = (ut32)(UINT (data, pos + 8));

ut32 default_loc = (ut32) (UINT (data, pos)), cur_case = 0;
op->switch_op = r_anal_switch_op_new (addr, min_val, default_loc);
Expand Down

0 comments on commit 224e6bc

Please sign in to comment.