Fix StackOverflowError due to non-commuting TransitionFunctionImpl.combineWith#281
Open
marcus-h wants to merge 1 commit intosecure-software-engineering:developfrom
Open
Fix StackOverflowError due to non-commuting TransitionFunctionImpl.combineWith#281marcus-h wants to merge 1 commit intosecure-software-engineering:developfrom
marcus-h wants to merge 1 commit intosecure-software-engineering:developfrom
Conversation
marcus-h
commented
Apr 23, 2026
…mbineWith According to the theory, the combineWith operation of the TransitionFunctionImpl class has to be, among other things, commuative. This can result in a StackOverflowError (see VectorTest.testNoStackOverflowDueToNonCommutativeCombineWith for a reproducer). Excerpt from the stack trace: ... at wpds.impl.PostStar.update(PostStar.java:335) at wpds.impl.PostStar$HandleNormalListener.onOutTransitionAdded(PostStar.java:227) at wpds.impl.WeightedPAutomaton.addWeightForTransition(WeightedPAutomaton.java:329) at sync.pds.solver.SyncPDSSolver$4.addWeightForTransition(SyncPDSSolver.java:194) at wpds.impl.PostStar.update(PostStar.java:335) at wpds.impl.PostStar$HandleNormalListener.onOutTransitionAdded(PostStar.java:227) at wpds.impl.WeightedPAutomaton.addWeightForTransition(WeightedPAutomaton.java:329) at sync.pds.solver.SyncPDSSolver$4.addWeightForTransition(SyncPDSSolver.java:194) at wpds.impl.PostStar.update(PostStar.java:335) at wpds.impl.PostStar$HandleNormalListener.onOutTransitionAdded(PostStar.java:227) at wpds.impl.WeightedPAutomaton.addWeightForTransition(WeightedPAutomaton.java:329) at sync.pds.solver.SyncPDSSolver$4.addWeightForTransition(SyncPDSSolver.java:194) at wpds.impl.PostStar.update(PostStar.java:335) at wpds.impl.PostStar$HandleNormalListener.onOutTransitionAdded(PostStar.java:227) at wpds.impl.WeightedPAutomaton.addWeightForTransition(WeightedPAutomaton.java:329) at sync.pds.solver.SyncPDSSolver$4.addWeightForTransition(SyncPDSSolver.java:194) at wpds.impl.PostStar.update(PostStar.java:335) ... When combining the two paths in doSth, a new TransitionFunctionImpl is created where the statement sequences are merged but the stateChangeStatement from one of the path is used. The latter causes the PostStar.update <-> WeightedPAutomaton.addWeightForTransition "ping-pong". In order to fix this, store stateChangeStatement(s) from both paths in a set. Implementation note: a LinkedHashSet is used so the getStateChangeStatement() can be easily implemented (whether the method itself is "meaningful" is debatable, though).
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.