@@ -423,6 +423,15 @@ predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
423
423
simpleInstructionLocalFlowStep ( nodeFrom .asInstruction ( ) , nodeTo .asInstruction ( ) )
424
424
}
425
425
426
+ pragma [ noinline]
427
+ private predicate getFieldSizeOfClass ( Class c , Type type , int size ) {
428
+ exists ( Field f |
429
+ f .getDeclaringType ( ) = c and
430
+ f .getType ( ) = type and
431
+ type .getSize ( ) = size
432
+ )
433
+ }
434
+
426
435
cached
427
436
private predicate simpleInstructionLocalFlowStep ( Instruction iFrom , Instruction iTo ) {
428
437
iTo .( CopyInstruction ) .getSourceValue ( ) = iFrom
@@ -472,12 +481,11 @@ private predicate simpleInstructionLocalFlowStep(Instruction iFrom, Instruction
472
481
)
473
482
or
474
483
// Flow from stores to structs with a single field to a load of that field.
475
- iTo .( LoadInstruction ) .getSourceValueOperand ( ) .getAnyDef ( ) = iFrom .( StoreInstruction ) and
476
- exists ( Class c , Type t |
477
- c = iTo .getResultType ( ) and
478
- t = iFrom .getResultType ( ) and
479
- c .getAField ( ) .getUnspecifiedType ( ) = t and
480
- c .getSize ( ) = t .getSize ( )
484
+ iTo .( LoadInstruction ) .getSourceValueOperand ( ) .getAnyDef ( ) = iFrom and
485
+ exists ( int size , Type type |
486
+ type = iFrom .getResultType ( ) and
487
+ iTo .getResultType ( ) .getSize ( ) = size and
488
+ getFieldSizeOfClass ( iTo .getResultType ( ) , type , size )
481
489
)
482
490
or
483
491
// Flow through modeled functions
0 commit comments