GeezerVison is showing github.com — C#/Java: Address review comments. · github/codeql@68165bb
File treeExpand file treeCollapse file tree Open diff view settings csharp/ql/src/utils/modelgenerator/internal java/ql/src/utils/modelgenerator/internal
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: csharp/ql/src/utils/modelgenerator/internal/CaptureModels.qll +15-27Lines changed: 15 additions & 27 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -311,8 +311,9 @@ private string printReadAccessPath(PropagateContentFlow::AccessPath ap) { | 311 | 311 | private predicate mentionsField(PropagateContentFlow::AccessPath ap) { | 312 | 312 | exists(ContentSet head, PropagateContentFlow::AccessPath tail | | 313 | 313 | head = ap.getHead() and | 314 | | - tail = ap.getTail() and | 315 | | - (mentionsField(tail) or isField(head)) | | 314 | + tail = ap.getTail() | | 315 | + | | | 316 | + mentionsField(tail) or isField(head) | 316 | 317 | ) | 317 | 318 | } | 318 | 319 |
| @@ -369,11 +370,10 @@ private predicate apiContentFlow( | 369 | 370 | private predicate hasSyntheticContent(PropagateContentFlow::AccessPath path) { | 370 | 371 | exists(PropagateContentFlow::AccessPath tail, ContentSet head | | 371 | 372 | head = path.getHead() and | 372 | | - tail = path.getTail() and | 373 | | - ( | 374 | | - exists(getSyntheticName(head)) or | 375 | | - hasSyntheticContent(tail) | 376 | | - ) | | 373 | + tail = path.getTail() | | 374 | + | | | 375 | + exists(getSyntheticName(head)) or | | 376 | + hasSyntheticContent(tail) | 377 | 377 | ) | 378 | 378 | } | 379 | 379 |
| @@ -425,24 +425,6 @@ private module AccessPathSyntheticValidation { | 425 | 425 | step(t1, read, t2, store) | 426 | 426 | } | 427 | 427 |
| 428 | | - /** | 429 | | - * Takes one or more synthetic steps. | 430 | | - * Synth ->+ Synth | 431 | | - */ | 432 | | - private predicate synthPathStepRec( | 433 | | - Type t1, PropagateContentFlow::AccessPath read, Type t2, PropagateContentFlow::AccessPath store | 434 | | - ) { | 435 | | - hasSyntheticContent(read) and | 436 | | - hasSyntheticContent(store) and | 437 | | - ( | 438 | | - step(t1, read, t2, store) | 439 | | - or | 440 | | - exists(PropagateContentFlow::AccessPath mid, Type midType | | 441 | | - step(t1, read, midType, mid) and synthPathStepRec(midType, mid.reverse(), t2, store) | 442 | | - ) | 443 | | - ) | 444 | | - } | 445 | | - | 446 | 428 | /** | 447 | 429 | * Holds if there exists a path of steps from `read` to an exit. | 448 | 430 | * | @@ -451,8 +433,11 @@ private module AccessPathSyntheticValidation { | 451 | 433 | private predicate reachesSynthExit(Type t, PropagateContentFlow::AccessPath read) { | 452 | 434 | synthPathExit(t, read, _, _) | 453 | 435 | or | | 436 | + hasSyntheticContent(read) and | 454 | 437 | exists(PropagateContentFlow::AccessPath mid, Type midType | | 455 | | - synthPathStepRec(t, read, midType, mid) and synthPathExit(midType, mid.reverse(), _, _) | | 438 | + hasSyntheticContent(mid) and | | 439 | + step(t, read, midType, mid) and | | 440 | + reachesSynthExit(midType, mid.reverse()) | 456 | 441 | ) | 457 | 442 | } | 458 | 443 |
| @@ -464,8 +449,11 @@ private module AccessPathSyntheticValidation { | 464 | 449 | private predicate synthEntryReaches(Type t, PropagateContentFlow::AccessPath store) { | 465 | 450 | synthPathEntry(_, _, t, store) | 466 | 451 | or | | 452 | + hasSyntheticContent(store) and | 467 | 453 | exists(PropagateContentFlow::AccessPath mid, Type midType | | 468 | | - synthPathEntry(_, _, midType, mid) and synthPathStepRec(midType, mid.reverse(), t, store) | | 454 | + hasSyntheticContent(mid) and | | 455 | + step(midType, mid, t, store) and | | 456 | + synthEntryReaches(midType, mid.reverse()) | 469 | 457 | ) | 470 | 458 | } | 471 | 459 |
| |
Collapse file Copy file name to clipboardExpand all lines: java/ql/src/utils/modelgenerator/internal/CaptureModels.qll +15-27Lines changed: 15 additions & 27 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -311,8 +311,9 @@ private string printReadAccessPath(PropagateContentFlow::AccessPath ap) { | 311 | 311 | private predicate mentionsField(PropagateContentFlow::AccessPath ap) { | 312 | 312 | exists(ContentSet head, PropagateContentFlow::AccessPath tail | | 313 | 313 | head = ap.getHead() and | 314 | | - tail = ap.getTail() and | 315 | | - (mentionsField(tail) or isField(head)) | | 314 | + tail = ap.getTail() | | 315 | + | | | 316 | + mentionsField(tail) or isField(head) | 316 | 317 | ) | 317 | 318 | } | 318 | 319 |
| @@ -369,11 +370,10 @@ private predicate apiContentFlow( | 369 | 370 | private predicate hasSyntheticContent(PropagateContentFlow::AccessPath path) { | 370 | 371 | exists(PropagateContentFlow::AccessPath tail, ContentSet head | | 371 | 372 | head = path.getHead() and | 372 | | - tail = path.getTail() and | 373 | | - ( | 374 | | - exists(getSyntheticName(head)) or | 375 | | - hasSyntheticContent(tail) | 376 | | - ) | | 373 | + tail = path.getTail() | | 374 | + | | | 375 | + exists(getSyntheticName(head)) or | | 376 | + hasSyntheticContent(tail) | 377 | 377 | ) | 378 | 378 | } | 379 | 379 |
| @@ -425,24 +425,6 @@ private module AccessPathSyntheticValidation { | 425 | 425 | step(t1, read, t2, store) | 426 | 426 | } | 427 | 427 |
| 428 | | - /** | 429 | | - * Takes one or more synthetic steps. | 430 | | - * Synth ->+ Synth | 431 | | - */ | 432 | | - private predicate synthPathStepRec( | 433 | | - Type t1, PropagateContentFlow::AccessPath read, Type t2, PropagateContentFlow::AccessPath store | 434 | | - ) { | 435 | | - hasSyntheticContent(read) and | 436 | | - hasSyntheticContent(store) and | 437 | | - ( | 438 | | - step(t1, read, t2, store) | 439 | | - or | 440 | | - exists(PropagateContentFlow::AccessPath mid, Type midType | | 441 | | - step(t1, read, midType, mid) and synthPathStepRec(midType, mid.reverse(), t2, store) | 442 | | - ) | 443 | | - ) | 444 | | - } | 445 | | - | 446 | 428 | /** | 447 | 429 | * Holds if there exists a path of steps from `read` to an exit. | 448 | 430 | * | @@ -451,8 +433,11 @@ private module AccessPathSyntheticValidation { | 451 | 433 | private predicate reachesSynthExit(Type t, PropagateContentFlow::AccessPath read) { | 452 | 434 | synthPathExit(t, read, _, _) | 453 | 435 | or | | 436 | + hasSyntheticContent(read) and | 454 | 437 | exists(PropagateContentFlow::AccessPath mid, Type midType | | 455 | | - synthPathStepRec(t, read, midType, mid) and synthPathExit(midType, mid.reverse(), _, _) | | 438 | + hasSyntheticContent(mid) and | | 439 | + step(t, read, midType, mid) and | | 440 | + reachesSynthExit(midType, mid.reverse()) | 456 | 441 | ) | 457 | 442 | } | 458 | 443 |
| @@ -464,8 +449,11 @@ private module AccessPathSyntheticValidation { | 464 | 449 | private predicate synthEntryReaches(Type t, PropagateContentFlow::AccessPath store) { | 465 | 450 | synthPathEntry(_, _, t, store) | 466 | 451 | or | | 452 | + hasSyntheticContent(store) and | 467 | 453 | exists(PropagateContentFlow::AccessPath mid, Type midType | | 468 | | - synthPathEntry(_, _, midType, mid) and synthPathStepRec(midType, mid.reverse(), t, store) | | 454 | + hasSyntheticContent(mid) and | | 455 | + step(midType, mid, t, store) and | | 456 | + synthEntryReaches(midType, mid.reverse()) | 469 | 457 | ) | 470 | 458 | } | 471 | 459 |
| |
|