Skip to content
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

Incorrect setting collection field to null leads to further problems with iterator #111

Open
tepa46 opened this issue Nov 16, 2023 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@tepa46
Copy link
Collaborator

tepa46 commented Nov 16, 2023

Generate tests in the following configuration:

timeLimit=60
methodFilter = "org.usvm.samples.arrays.ArrayStoreExceptionExamples.*"
projectFilter = listOf("samples")

An failing test:

@Test
    public void testFillWithTreeSet1() throws Exception  {
        ArrayStoreExceptionExamples arrayStoreExceptionExamples = new ArrayStoreExceptionExamples();
        TreeSet treeSet = ((TreeSet) createInstance("java.util.TreeSet"));
        setField(treeSet, "java.util.TreeSet", "m", null);
        
        java.lang.Object[] actual = arrayStoreExceptionExamples.fillWithTreeSet(treeSet);
        
        java.lang.Object[] expected = new java.lang.Object[1];
        TreeSet treeSet1 = ((TreeSet) createInstance("java.util.TreeSet"));
        Object present = createInstance("java.lang.Object");
        setField(treeSet1, "java.util.TreeSet", "PRESENT", present);
        setField(treeSet1, "java.util.TreeSet", "serialVersionUID", -2479143000061671589L);
        setField(treeSet1, "java.util.AbstractCollection", "MAX_ARRAY_SIZE", 2147483639);
        expected[0] = ((Object) treeSet1);
        
        int expectedSize = expected.length;
        assertEquals(expectedSize, actual.length);
        assertTrue(deepEquals(expected, actual));
    }

Let's pay attention to the line: setField(treeSet, "java.util.TreeSet", "m", null);
During the deepEquals method call, NullPointerException occurs.

image
image

@tepa46 tepa46 added the bug Something isn't working label Nov 16, 2023
@EgorkaKulikov EgorkaKulikov changed the title NullPointerException when calling the deepEquals method Incorrect setting collection field to null leads to further problems with iterator Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants