@@ -1173,8 +1173,6 @@ pub struct ValueLocationComponent {
11731173 pub variable : Variable ,
11741174 pub offset : i64 ,
11751175 pub size : Option < u64 > ,
1176- pub indirect : bool ,
1177- pub returned_pointer : Option < Variable > ,
11781176}
11791177
11801178impl ValueLocationComponent {
@@ -1189,12 +1187,6 @@ impl ValueLocationComponent {
11891187 variable,
11901188 offset : value. offset ,
11911189 size,
1192- indirect : value. indirect ,
1193- returned_pointer : if value. returnedPointerValid {
1194- Some ( Variable :: from ( & value. returnedPointer ) )
1195- } else {
1196- None
1197- } ,
11981190 }
11991191 }
12001192
@@ -1204,20 +1196,15 @@ impl ValueLocationComponent {
12041196 offset : value. offset ,
12051197 sizeValid : value. size . is_some ( ) ,
12061198 size : value. size . unwrap_or ( 0 ) ,
1207- indirect : value. indirect ,
1208- returnedPointerValid : value. returned_pointer . is_some ( ) ,
1209- returnedPointer : if let Some ( ptr) = value. returned_pointer {
1210- ptr. into ( )
1211- } else {
1212- Variable :: new ( VariableSourceType :: RegisterVariableSourceType , 0 , 0 ) . into ( )
1213- } ,
12141199 }
12151200 }
12161201}
12171202
12181203#[ derive( Debug , Clone , Hash , PartialEq , Eq ) ]
12191204pub struct ValueLocation {
12201205 pub components : Vec < ValueLocationComponent > ,
1206+ pub indirect : bool ,
1207+ pub returned_pointer : Option < Variable > ,
12211208}
12221209
12231210impl ValueLocation {
@@ -1227,9 +1214,9 @@ impl ValueLocation {
12271214 variable: var,
12281215 offset: 0 ,
12291216 size: None ,
1230- indirect: false ,
1231- returned_pointer: None ,
12321217 } ] ,
1218+ indirect : false ,
1219+ returned_pointer : None ,
12331220 }
12341221 }
12351222
@@ -1274,20 +1261,20 @@ impl ValueLocation {
12741261 }
12751262 }
12761263
1277- pub ( crate ) fn from_raw ( components : & BNValueLocation ) -> Self {
1278- if components. count == 0 {
1279- return Self {
1280- components : Vec :: new ( ) ,
1281- } ;
1282- }
1283-
1264+ pub ( crate ) fn from_raw ( loc : & BNValueLocation ) -> Self {
12841265 let components_raw: & [ BNValueLocationComponent ] =
1285- unsafe { std :: slice :: from_raw_parts ( components . components , components . count ) } ;
1266+ unsafe { crate :: ffi :: slice_from_raw_parts ( loc . components , loc . count ) } ;
12861267 Self {
12871268 components : components_raw
12881269 . iter ( )
12891270 . map ( |component| ValueLocationComponent :: from_raw ( component) )
12901271 . collect ( ) ,
1272+ indirect : loc. indirect ,
1273+ returned_pointer : if loc. returnedPointerValid {
1274+ Some ( Variable :: from ( & loc. returnedPointer ) )
1275+ } else {
1276+ None
1277+ } ,
12911278 }
12921279 }
12931280
@@ -1300,6 +1287,13 @@ impl ValueLocation {
13001287 BNValueLocation {
13011288 count : components. len ( ) ,
13021289 components : Box :: leak ( components) . as_mut_ptr ( ) ,
1290+ indirect : value. indirect ,
1291+ returnedPointerValid : value. returned_pointer . is_some ( ) ,
1292+ returnedPointer : if let Some ( ptr) = value. returned_pointer {
1293+ ptr. into ( )
1294+ } else {
1295+ Variable :: new ( VariableSourceType :: RegisterVariableSourceType , 0 , 0 ) . into ( )
1296+ } ,
13031297 }
13041298 }
13051299
@@ -1318,9 +1312,9 @@ impl Into<ValueLocation> for Variable {
13181312 variable: self ,
13191313 offset: 0 ,
13201314 size: None ,
1321- indirect: false ,
1322- returned_pointer: None ,
13231315 } ] ,
1316+ indirect : false ,
1317+ returned_pointer : None ,
13241318 }
13251319 }
13261320}
@@ -1367,6 +1361,8 @@ impl ReturnValue {
13671361 . map ( |v| & v. contents )
13681362 . unwrap_or ( & ValueLocation {
13691363 components : Vec :: new ( ) ,
1364+ indirect : false ,
1365+ returned_pointer : None ,
13701366 } ) ,
13711367 ) ,
13721368 locationConfidence : value. location . as_ref ( ) . map ( |v| v. confidence ) . unwrap_or ( 0 ) ,
@@ -1476,6 +1472,8 @@ impl FunctionParameter {
14761472 defaultLocation : value. location . is_none ( ) ,
14771473 location : ValueLocation :: into_rust_raw ( & value. location . unwrap_or ( ValueLocation {
14781474 components : Vec :: new ( ) ,
1475+ indirect : false ,
1476+ returned_pointer : None ,
14791477 } ) ) ,
14801478 }
14811479 }
0 commit comments