fix(ddg): drop dependence edges whose endpoint is not a body node - #229
Merged
Conversation
A WALA instruction whose covering source statement cannot be identified maps
to the sentinel "<line>:0" — a well-formed localId that names no body node.
Both PDG producers emitted edges on it, so 90 of 5,475 ddg edges on daytrader8
at -a 4 dangled, every one carrying prov:["points-to"].
Such an edge is unfollowable. The Neo4j emitter materialises body nodes from
body{}, so it silently could not write them, which made ddg the only place a
consumer reading both artefacts saw them disagree. Dropping is sound in the
direction that matters: the sentinel marks an over-approximation, so the edge
is a may-dependence whose exact endpoint was never established. Emitting a
synthetic vertex instead would need a body-node kind the schema has no
vocabulary for.
DdgEdges.dropDangling is applied by both attach points — L3WalaOverlays for
the wala engine's own ddg and L4WalaOverlays.merge for the points-to half —
so no producer can reintroduce the shape. The L3 log line now reports what it
dropped.
On daytrader8 at -a 4: 90 dangling edges before, 0 after, and the JSON and the
Neo4j snapshot now report the same 5,385 ddg edges.
Closes #228
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #228
Cause
InstructionToNode.mapreturns the sentinel"<line>:0"when it cannot uniquely identify the source statement covering a WALA instruction. It is a well-formedlocalIdbut names no body node, and both PDG producers emitted edges on it.Fix
DdgEdges.dropDanglingdrops any edge whosesrcordstis not a key of the callable's ownbody{}, applied at both attach points —L3WalaOverlays(the wala engine's ddg) andL4WalaOverlays.merge(the points-to half) — so no producer can reintroduce the shape.Dropping rather than emitting a
<line>:0vertex: the sentinel marks an over-approximation, so the edge is a may-dependence whose exact endpoint was never established, and a synthetic vertex would need a body-node kind the schema vocabulary does not have.Verified
daytrader8 at
-a 4:<line>:0, allprov:["points-to"])The Neo4j snapshot of the same build now reports 5,385
J_DDGedges — exactly the JSON count, so the one measured disagreement between the two artefacts is gone../gradlew test: 511/512 pass, 4 skipped. The single failure isCodeAnalyzerIntegrationTest("Could not find a valid Docker environment"), which fails identically onmainhere.