@@ -282,25 +282,21 @@ class OperatorNewAllocationFunction extends AllocationFunction {
282282 * is `a * 2` and `sizeof` is `4`.
283283 */
284284private predicate deconstructSizeExpr ( Expr sizeExpr , Expr lengthExpr , int sizeof ) {
285- if
286- sizeExpr instanceof MulExpr and
287- exists ( SizeofOperator sizeofOp , Expr lengthOp |
288- sizeofOp = sizeExpr .( MulExpr ) .getAnOperand ( ) and
289- lengthOp = sizeExpr .( MulExpr ) .getAnOperand ( ) and
290- not lengthOp instanceof SizeofOperator and
291- exists ( sizeofOp .getValue ( ) .toInt ( ) )
292- )
293- then
294- exists ( SizeofOperator sizeofOp |
295- sizeofOp = sizeExpr .( MulExpr ) .getAnOperand ( ) and
296- lengthExpr = sizeExpr .( MulExpr ) .getAnOperand ( ) and
297- not lengthExpr instanceof SizeofOperator and
298- sizeof = sizeofOp .getValue ( ) .toInt ( )
299- )
300- else (
301- lengthExpr = sizeExpr and
302- sizeof = 1
285+ exists ( SizeofOperator sizeofOp |
286+ sizeofOp = sizeExpr .( MulExpr ) .getAnOperand ( ) and
287+ lengthExpr = sizeExpr .( MulExpr ) .getAnOperand ( ) and
288+ not lengthExpr instanceof SizeofOperator and
289+ sizeof = sizeofOp .getValue ( ) .toInt ( )
303290 )
291+ or
292+ not exists ( SizeofOperator sizeofOp , Expr lengthOp |
293+ sizeofOp = sizeExpr .( MulExpr ) .getAnOperand ( ) and
294+ lengthOp = sizeExpr .( MulExpr ) .getAnOperand ( ) and
295+ not lengthOp instanceof SizeofOperator and
296+ exists ( sizeofOp .getValue ( ) .toInt ( ) )
297+ ) and
298+ lengthExpr = sizeExpr and
299+ sizeof = 1
304300}
305301
306302/**
0 commit comments