Skip to content

NPE in TaintedArrayGene - #1777

Merged
arcuri82 merged 2 commits into
feature/cassandra-actionsfrom
fix/tainted-array-gene-unsafe-copy
Sep 22, 2026
Merged

arcuri82 merged 2 commits into
feature/cassandra-actionsfrom
fix/tainted-array-gene-unsafe-copy

Conversation

@gonzalotguerrero

@gonzalotguerrero gonzalotguerrero commented Sep 18, 2026

Copy link
Copy Markdown
Collaborator

#1729 adds a new gene class for CQL's duration data type

After merging master into that branch, test case with seed 1384 in class GeneRandomizedTest began to fail due to a NPE in TaintedArrayGene's unsafeCopyValueFrom implementation, more specifically in
return this.arrayGene?.unsafeCopyValueFrom(other.arrayGene!!) ?: true
due to other.arrayGene being null.

Copying from an unresolved gene into a resolved one threw a NullPointerException, and the opposite direction reported a successful copy without copying anything. This PR suggests returning false for both scenarios.

TaintedArrayGeneTest.testChoiceCopiesIntoTheAlternativeInTheSameState() represents the scenario for seed 1384 (for the current list of available gene classes) from which the NPE originated.

@jgaleotti
jgaleotti requested a review from arcuri82 September 18, 2026 16:45
Resolving a taint adds the array as a child, so a resolved and an unresolved gene do not
have the same structure, and copying a value cannot turn one into the other
*/
if(this.isResolved() != other.isResolved()){

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rather than returning false, should handle this case. eg, this.arrayGene could be put to null or created, and taintedValue could be copied

@arcuri82
arcuri82 merged commit a8b4200 into feature/cassandra-actions Sep 22, 2026
31 checks passed
@arcuri82
arcuri82 deleted the fix/tainted-array-gene-unsafe-copy branch September 22, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants