Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b156782

Browse files
committed
Python: Repair flow out of post-update nodes
1 parent 9e59d79 commit b156782

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

python/ql/src/experimental/dataflow/internal/DataFlowPrivate.qll

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class StorePreUpdateNode extends PreUpdateNode, CfgNode {
3232
}
3333
}
3434

35-
/** A node marking the state change of an object after a read */
35+
/** A node marking the state change of an object after a read. */
3636
class ReadPreUpdateNode extends PreUpdateNode, CfgNode {
3737
ReadPreUpdateNode() {
3838
exists(Attribute a |
@@ -147,9 +147,12 @@ module EssaFlow {
147147
* excludes SSA flow through instance fields.
148148
*/
149149
predicate simpleLocalFlowStep(Node nodeFrom, Node nodeTo) {
150-
not nodeFrom.(EssaNode).getVar() instanceof GlobalSsaVariable and
151-
not nodeTo.(EssaNode).getVar() instanceof GlobalSsaVariable and
152-
EssaFlow::essaFlowStep(update(nodeFrom), nodeTo)
150+
exists(Node preUpdate |
151+
not preUpdate.(EssaNode).getVar() instanceof GlobalSsaVariable and
152+
not nodeTo.(EssaNode).getVar() instanceof GlobalSsaVariable and
153+
EssaFlow::essaFlowStep(preUpdate, nodeTo) and
154+
nodeFrom = update(preUpdate)
155+
)
153156
}
154157

155158
/**

python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/TestTaint.expected

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
| test_collections.py:149 | ok | list_index_aug_assign | my_list |
5151
| test_collections.py:152 | fail | list_index_aug_assign | my_list |
5252
| test_collections.py:159 | ok | list_append | my_list |
53-
| test_collections.py:162 | fail | list_append | my_list |
53+
| test_collections.py:162 | ok | list_append | my_list |
5454
| test_collections.py:169 | ok | list_extend | my_list |
5555
| test_collections.py:172 | fail | list_extend | my_list |
5656
| test_collections.py:179 | ok | dict_update_dict | my_dict |
@@ -63,7 +63,7 @@
6363
| test_collections.py:212 | fail | dict_manual_update | my_dict |
6464
| test_collections.py:220 | fail | dict_merge | merged |
6565
| test_collections.py:227 | ok | set_add | my_set |
66-
| test_collections.py:230 | fail | set_add | my_set |
66+
| test_collections.py:230 | ok | set_add | my_set |
6767
| test_json.py:26 | ok | test | json.dumps(..) |
6868
| test_json.py:27 | ok | test | json.loads(..) |
6969
| test_json.py:34 | fail | test | tainted_filelike |

0 commit comments

Comments
 (0)