@@ -3408,7 +3408,7 @@ private module StdlibPrivate {
3408
3408
*
3409
3409
* See https://docs.python.org/3.10/library/xml.sax.reader.html#xml.sax.xmlreader.XMLReader.setFeature
3410
3410
*/
3411
- private class SaxParserSetFeatureCall extends DataFlow:: MethodCallNode {
3411
+ private class SaxParserSetFeatureCall extends API :: CallNode , DataFlow:: MethodCallNode {
3412
3412
SaxParserSetFeatureCall ( ) {
3413
3413
this =
3414
3414
API:: moduleImport ( "xml" )
@@ -3421,27 +3421,9 @@ private module StdlibPrivate {
3421
3421
3422
3422
// The keyword argument names does not match documentation. I checked (with Python
3423
3423
// 3.9.5) that the names used here actually works.
3424
- DataFlow :: Node getFeatureArg ( ) { result in [ this .getArg ( 0 ) , this . getArgByName ( "name" ) ] }
3424
+ API :: Node getFeatureArg ( ) { result = this .getParameter ( 0 , "name" ) }
3425
3425
3426
- DataFlow:: Node getStateArg ( ) { result in [ this .getArg ( 1 ) , this .getArgByName ( "state" ) ] }
3427
- }
3428
-
3429
- /** Gets a back-reference to the `setFeature` state argument `arg`. */
3430
- private DataFlow:: TypeTrackingNode saxParserSetFeatureStateArgBacktracker (
3431
- DataFlow:: TypeBackTracker t , DataFlow:: Node arg
3432
- ) {
3433
- t .start ( ) and
3434
- arg = any ( SaxParserSetFeatureCall c ) .getStateArg ( ) and
3435
- result = arg .getALocalSource ( )
3436
- or
3437
- exists ( DataFlow:: TypeBackTracker t2 |
3438
- result = saxParserSetFeatureStateArgBacktracker ( t2 , arg ) .backtrack ( t2 , t )
3439
- )
3440
- }
3441
-
3442
- /** Gets a back-reference to the `setFeature` state argument `arg`. */
3443
- DataFlow:: LocalSourceNode saxParserSetFeatureStateArgBacktracker ( DataFlow:: Node arg ) {
3444
- result = saxParserSetFeatureStateArgBacktracker ( DataFlow:: TypeBackTracker:: end ( ) , arg )
3426
+ API:: Node getStateArg ( ) { result = this .getParameter ( 1 , "state" ) }
3445
3427
}
3446
3428
3447
3429
/**
@@ -3452,16 +3434,13 @@ private module StdlibPrivate {
3452
3434
private DataFlow:: Node saxParserWithFeatureExternalGesTurnedOn ( DataFlow:: TypeTracker t ) {
3453
3435
t .start ( ) and
3454
3436
exists ( SaxParserSetFeatureCall call |
3455
- call .getFeatureArg ( ) =
3437
+ call .getFeatureArg ( ) . getARhs ( ) =
3456
3438
API:: moduleImport ( "xml" )
3457
3439
.getMember ( "sax" )
3458
3440
.getMember ( "handler" )
3459
3441
.getMember ( "feature_external_ges" )
3460
3442
.getAUse ( ) and
3461
- saxParserSetFeatureStateArgBacktracker ( call .getStateArg ( ) )
3462
- .asExpr ( )
3463
- .( BooleanLiteral )
3464
- .booleanValue ( ) = true and
3443
+ call .getStateArg ( ) .getAValueReachingRhs ( ) .asExpr ( ) .( BooleanLiteral ) .booleanValue ( ) = true and
3465
3444
result = call .getObject ( )
3466
3445
)
3467
3446
or
@@ -3471,16 +3450,13 @@ private module StdlibPrivate {
3471
3450
// take account of that we can set the feature to False, which makes the parser safe again
3472
3451
not exists ( SaxParserSetFeatureCall call |
3473
3452
call .getObject ( ) = result and
3474
- call .getFeatureArg ( ) =
3453
+ call .getFeatureArg ( ) . getARhs ( ) =
3475
3454
API:: moduleImport ( "xml" )
3476
3455
.getMember ( "sax" )
3477
3456
.getMember ( "handler" )
3478
3457
.getMember ( "feature_external_ges" )
3479
3458
.getAUse ( ) and
3480
- saxParserSetFeatureStateArgBacktracker ( call .getStateArg ( ) )
3481
- .asExpr ( )
3482
- .( BooleanLiteral )
3483
- .booleanValue ( ) = false
3459
+ call .getStateArg ( ) .getAValueReachingRhs ( ) .asExpr ( ) .( BooleanLiteral ) .booleanValue ( ) = false
3484
3460
)
3485
3461
}
3486
3462
0 commit comments