Skip to content

[draft] Check for ArrayStoreException on array update #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

dtim
Copy link
Collaborator

@dtim dtim commented Sep 19, 2022

Description

This PR adds a check to TraversalContext.traverseAssignLeftPart to detect if ArrayStoreException should be thrown for the given array element assignment statement.

The exception is generated if the type of the value on the right-hand side of the assignment is not a subtype of the array elements type and is not null.

This change affects all code that explicitly assigns array elements, as well as all calls to Objects.arraycopy.

Fixes #923

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

New executions may be generated for the code that involves array modification.

How Has This Been Tested?

Automated Testing

All existing unit tests should pass.

A new test suite org.utbot.examples.arrays.ArrayStoreExceptionExamplesTest has been added, it should pass with and without concrete execution.

Manual Scenario

TODO

Checklist:

This is the author self-check list

  • The change followed the style guidelines of the UTBot project
  • Self-review of the code is passed
  • The change contains enough commentaries, particularly in hard-to-understand areas
  • New documentation is provided or existed one is altered
  • No new warnings
  • New tests have been added
  • All tests pass locally with my changes

@dtim dtim force-pushed the dtim/921_arraystoreexception branch from 7655f69 to 84ca477 Compare September 19, 2022 15:08
@dtim dtim closed this Sep 19, 2022
@dtim dtim deleted the dtim/921_arraystoreexception branch September 19, 2022 15:23
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.

Detect ArrayStoreException on illegal array writes
1 participant