Skip to content

Commit ea08356

Browse files
committed
[Rust] Fix MLIL function expression index usage in place of instruction index
Discovered when poking at variable values in WARP
1 parent 4edbacc commit ea08356

File tree

1 file changed

+33
-30
lines changed

1 file changed

+33
-30
lines changed

rust/src/medium_level_il/instruction.rs

Lines changed: 33 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ impl MediumLevelILInstruction {
11621162
let value = unsafe {
11631163
BNGetMediumLevelILPossibleExprValues(
11641164
self.function.handle,
1165-
self.expr_index.0,
1165+
self.instr_index.0,
11661166
options.as_ptr() as *mut _,
11671167
options.len(),
11681168
)
@@ -1185,7 +1185,7 @@ impl MediumLevelILInstruction {
11851185
self.function.handle,
11861186
&raw_var,
11871187
ssa_var.version,
1188-
self.expr_index.0,
1188+
self.instr_index.0,
11891189
options.as_ptr() as *mut _,
11901190
options.len(),
11911191
)
@@ -1200,7 +1200,7 @@ impl MediumLevelILInstruction {
12001200
BNGetMediumLevelILSSAVarVersionAtILInstruction(
12011201
self.function.handle,
12021202
&raw_var,
1203-
self.expr_index.0,
1203+
self.instr_index.0,
12041204
)
12051205
};
12061206
SSAVariable::new(var, version)
@@ -1213,7 +1213,7 @@ impl MediumLevelILInstruction {
12131213
BNGetMediumLevelILSSAVarVersionAfterILInstruction(
12141214
self.function.handle,
12151215
&raw_var,
1216-
self.expr_index.0,
1216+
self.instr_index.0,
12171217
)
12181218
};
12191219
SSAVariable::new(var, version)
@@ -1225,24 +1225,27 @@ impl MediumLevelILInstruction {
12251225
let deps = unsafe {
12261226
BNGetAllMediumLevelILBranchDependence(
12271227
self.function.handle,
1228-
self.expr_index.0,
1228+
self.instr_index.0,
12291229
&mut count,
12301230
)
12311231
};
12321232
assert!(!deps.is_null());
12331233
unsafe { Array::new(deps, count, self.function.clone()) }
12341234
}
12351235

1236-
pub fn branch_dependence_at(&self, instruction: MediumLevelILInstruction) -> BranchDependence {
1236+
pub fn branch_dependence_at(
1237+
&self,
1238+
branch_instruction: MediumLevelILInstruction,
1239+
) -> BranchDependence {
12371240
let deps = unsafe {
12381241
BNGetMediumLevelILBranchDependence(
12391242
self.function.handle,
1240-
self.expr_index.0,
1241-
instruction.expr_index.0,
1243+
self.instr_index.0,
1244+
branch_instruction.instr_index.0,
12421245
)
12431246
};
12441247
BranchDependence {
1245-
instruction,
1248+
instruction: branch_instruction,
12461249
dependence: deps,
12471250
}
12481251
}
@@ -1252,7 +1255,7 @@ impl MediumLevelILInstruction {
12521255
unsafe {
12531256
BNGetMediumLevelILSSAMemoryVersionAtILInstruction(
12541257
self.function.handle,
1255-
self.expr_index.0,
1258+
self.instr_index.0,
12561259
)
12571260
}
12581261
}
@@ -1262,7 +1265,7 @@ impl MediumLevelILInstruction {
12621265
unsafe {
12631266
BNGetMediumLevelILSSAMemoryVersionAfterILInstruction(
12641267
self.function.handle,
1265-
self.expr_index.0,
1268+
self.instr_index.0,
12661269
)
12671270
}
12681271
}
@@ -1289,7 +1292,7 @@ impl MediumLevelILInstruction {
12891292
BNGetMediumLevelILVariableForRegisterAtInstruction(
12901293
self.function.handle,
12911294
reg_id.0,
1292-
self.expr_index.0,
1295+
self.instr_index.0,
12931296
)
12941297
};
12951298
Variable::from(result)
@@ -1300,7 +1303,7 @@ impl MediumLevelILInstruction {
13001303
BNGetMediumLevelILVariableForRegisterAfterInstruction(
13011304
self.function.handle,
13021305
reg_id.0,
1303-
self.expr_index.0,
1306+
self.instr_index.0,
13041307
)
13051308
};
13061309
Variable::from(result)
@@ -1311,7 +1314,7 @@ impl MediumLevelILInstruction {
13111314
BNGetMediumLevelILVariableForFlagAtInstruction(
13121315
self.function.handle,
13131316
flag_id.0,
1314-
self.expr_index.0,
1317+
self.instr_index.0,
13151318
)
13161319
};
13171320
Variable::from(result)
@@ -1322,7 +1325,7 @@ impl MediumLevelILInstruction {
13221325
BNGetMediumLevelILVariableForFlagAfterInstruction(
13231326
self.function.handle,
13241327
flag_id.0,
1325-
self.expr_index.0,
1328+
self.instr_index.0,
13261329
)
13271330
};
13281331
Variable::from(result)
@@ -1333,7 +1336,7 @@ impl MediumLevelILInstruction {
13331336
BNGetMediumLevelILVariableForStackLocationAtInstruction(
13341337
self.function.handle,
13351338
offset,
1336-
self.expr_index.0,
1339+
self.instr_index.0,
13371340
)
13381341
};
13391342
Variable::from(result)
@@ -1344,7 +1347,7 @@ impl MediumLevelILInstruction {
13441347
BNGetMediumLevelILVariableForStackLocationAfterInstruction(
13451348
self.function.handle,
13461349
offset,
1347-
self.expr_index.0,
1350+
self.instr_index.0,
13481351
)
13491352
};
13501353
Variable::from(result)
@@ -1355,7 +1358,7 @@ impl MediumLevelILInstruction {
13551358
BNGetMediumLevelILRegisterValueAtInstruction(
13561359
self.function.handle,
13571360
reg_id.0,
1358-
self.expr_index.0,
1361+
self.instr_index.0,
13591362
)
13601363
}
13611364
.into()
@@ -1366,7 +1369,7 @@ impl MediumLevelILInstruction {
13661369
BNGetMediumLevelILRegisterValueAfterInstruction(
13671370
self.function.handle,
13681371
reg_id.0,
1369-
self.expr_index.0,
1372+
self.instr_index.0,
13701373
)
13711374
}
13721375
.into()
@@ -1385,7 +1388,7 @@ impl MediumLevelILInstruction {
13851388
BNGetMediumLevelILPossibleRegisterValuesAtInstruction(
13861389
self.function.handle,
13871390
reg_id.0,
1388-
self.expr_index.0,
1391+
self.instr_index.0,
13891392
options.as_ptr() as *mut _,
13901393
options.len(),
13911394
)
@@ -1406,7 +1409,7 @@ impl MediumLevelILInstruction {
14061409
BNGetMediumLevelILPossibleRegisterValuesAfterInstruction(
14071410
self.function.handle,
14081411
reg_id.0,
1409-
self.expr_index.0,
1412+
self.instr_index.0,
14101413
options.as_ptr() as *mut _,
14111414
options.len(),
14121415
)
@@ -1419,7 +1422,7 @@ impl MediumLevelILInstruction {
14191422
BNGetMediumLevelILFlagValueAtInstruction(
14201423
self.function.handle,
14211424
flag_id.0,
1422-
self.expr_index.0,
1425+
self.instr_index.0,
14231426
)
14241427
}
14251428
.into()
@@ -1430,7 +1433,7 @@ impl MediumLevelILInstruction {
14301433
BNGetMediumLevelILFlagValueAfterInstruction(
14311434
self.function.handle,
14321435
flag_id.0,
1433-
self.expr_index.0,
1436+
self.instr_index.0,
14341437
)
14351438
}
14361439
.into()
@@ -1449,7 +1452,7 @@ impl MediumLevelILInstruction {
14491452
BNGetMediumLevelILPossibleFlagValuesAtInstruction(
14501453
self.function.handle,
14511454
flag_id.0,
1452-
self.expr_index.0,
1455+
self.instr_index.0,
14531456
options.as_ptr() as *mut _,
14541457
options.len(),
14551458
)
@@ -1466,7 +1469,7 @@ impl MediumLevelILInstruction {
14661469
BNGetMediumLevelILPossibleFlagValuesAfterInstruction(
14671470
self.function.handle,
14681471
flag_id.0,
1469-
self.expr_index.0,
1472+
self.instr_index.0,
14701473
options.as_ptr() as *mut _,
14711474
options.len(),
14721475
)
@@ -1480,7 +1483,7 @@ impl MediumLevelILInstruction {
14801483
self.function.handle,
14811484
offset,
14821485
size,
1483-
self.expr_index.0,
1486+
self.instr_index.0,
14841487
)
14851488
}
14861489
.into()
@@ -1492,7 +1495,7 @@ impl MediumLevelILInstruction {
14921495
self.function.handle,
14931496
offset,
14941497
size,
1495-
self.expr_index.0,
1498+
self.instr_index.0,
14961499
)
14971500
}
14981501
.into()
@@ -1509,7 +1512,7 @@ impl MediumLevelILInstruction {
15091512
self.function.handle,
15101513
offset,
15111514
size,
1512-
self.expr_index.0,
1515+
self.instr_index.0,
15131516
options.as_ptr() as *mut _,
15141517
options.len(),
15151518
)
@@ -1528,7 +1531,7 @@ impl MediumLevelILInstruction {
15281531
self.function.handle,
15291532
offset,
15301533
size,
1531-
self.expr_index.0,
1534+
self.instr_index.0,
15321535
options.as_ptr() as *mut _,
15331536
options.len(),
15341537
)
@@ -1547,7 +1550,7 @@ impl MediumLevelILInstruction {
15471550
BNGetDefaultIndexForMediumLevelILVariableDefinition(
15481551
self.function.handle,
15491552
&raw_var,
1550-
self.expr_index.0,
1553+
self.instr_index.0,
15511554
)
15521555
};
15531556
Variable::new(var.ty, index, var.storage)

0 commit comments

Comments
 (0)