Description
Description
Fuzzer advices to create byte array with following numbers:
Integer.MAX_VALUE
Integer.MIN_VALUE
-1
This breaks test generation.
To Reproduce
Steps to reproduce the behavior:
- JDK8,
fastjson-1.2.50
- Apply following patch - patch_for_repro.patch.txt. it setups required classes
Expected behavior
Tests are supposed to be generated.
Actual behavior
Following exceptions occurs
Negative size
``` Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:489) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:487) at org.utbot.instrumentation.process.SecurityKt$runSandbox$1$1.invoke(Security.kt:38) at org.utbot.instrumentation.process.SecurityKt$sandbox$1.invoke(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt$sandbox$2.invoke(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt$sandbox$3.invoke(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt$sandbox$4.run(Security.kt:88) at java.security.AccessController.doPrivileged(Native Method) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:88) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt.runSandbox(Security.kt:38) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.call(MockValueConstructor.kt:487) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:426) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:367) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.construct(MockValueConstructor.kt:136) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:111) at org.utbot.instrumentation.instrumentation.execution.phases.ValueConstructionContext.constructParameters(ValueConstructionContext.kt:39) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:94) ... 18 more Caused by: java.lang.NegativeArraySizeException at com.alibaba.fastjson.asm.ByteVector.(ByteVector.java:63) ... 42 more ```Requested array size exceeds VM limit
``` Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:489) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:487) at org.utbot.instrumentation.process.SecurityKt$runSandbox$1$1.invoke(Security.kt:38) at org.utbot.instrumentation.process.SecurityKt$sandbox$1.invoke(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt$sandbox$2.invoke(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt$sandbox$3.invoke(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt$sandbox$4.run(Security.kt:88) at java.security.AccessController.doPrivileged(Native Method) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:88) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt.runSandbox(Security.kt:38) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.call(MockValueConstructor.kt:487) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:426) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:367) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.construct(MockValueConstructor.kt:136) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:111) at org.utbot.instrumentation.instrumentation.execution.phases.ValueConstructionContext.constructParameters(ValueConstructionContext.kt:39) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:94) ... 18 more Caused by: java.lang.OutOfMemoryError: Requested array size exceeds VM limit at com.alibaba.fastjson.asm.ByteVector.(ByteVector.java:63) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:489) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:487) at org.utbot.instrumentation.process.SecurityKt$runSandbox$1$1.invoke(Security.kt:38) at org.utbot.instrumentation.process.SecurityKt$sandbox$1.invoke(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt$sandbox$2.invoke(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt$sandbox$3.invoke(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt$sandbox$4.run(Security.kt:88) at java.security.AccessController.doPrivileged(Native Method) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:88) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt.runSandbox(Security.kt:38) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.call(MockValueConstructor.kt:487) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:426) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:367) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.construct(MockValueConstructor.kt:136) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:111) at org.utbot.instrumentation.instrumentation.execution.phases.ValueConstructionContext.constructParameters(ValueConstructionContext.kt:39) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:94) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:53) at org.utbot.instrumentation.process.InstrumentedProcessMainKt$setup$2.invoke(InstrumentedProcessMain.kt:134) at org.utbot.instrumentation.process.InstrumentedProcessMainKt$setup$2.invoke(InstrumentedProcessMain.kt:130) ```Out of memory
``` Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:489) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:487) at org.utbot.instrumentation.process.SecurityKt$runSandbox$1$1.invoke(Security.kt:38) at org.utbot.instrumentation.process.SecurityKt$sandbox$1.invoke(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt$sandbox$2.invoke(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt$sandbox$3.invoke(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt$sandbox$4.run(Security.kt:88) at java.security.AccessController.doPrivileged(Native Method) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:88) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt.runSandbox(Security.kt:38) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.call(MockValueConstructor.kt:487) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:426) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:367) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.construct(MockValueConstructor.kt:136) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:111) at org.utbot.instrumentation.instrumentation.execution.phases.ValueConstructionContext.constructParameters(ValueConstructionContext.kt:39) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:94) ... 18 more Caused by: java.lang.OutOfMemoryError: Requested array size exceeds VM limit at com.alibaba.fastjson.asm.ByteVector.(ByteVector.java:63) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:489) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor$call$2.invoke(MockValueConstructor.kt:487) at org.utbot.instrumentation.process.SecurityKt$runSandbox$1$1.invoke(Security.kt:38) at org.utbot.instrumentation.process.SecurityKt$sandbox$1.invoke(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt$sandbox$2.invoke(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt$sandbox$3.invoke(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt$sandbox$4.run(Security.kt:88) at java.security.AccessController.doPrivileged(Native Method) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:88) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:82) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:77) at org.utbot.instrumentation.process.SecurityKt.sandbox(Security.kt:61) at org.utbot.instrumentation.process.SecurityKt.runSandbox(Security.kt:38) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.call(MockValueConstructor.kt:487) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.updateWithExecutableCallModel(MockValueConstructor.kt:426) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructFromAssembleModel(MockValueConstructor.kt:367) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.construct(MockValueConstructor.kt:136) at org.utbot.instrumentation.instrumentation.execution.constructors.MockValueConstructor.constructMethodParameters(MockValueConstructor.kt:111) at org.utbot.instrumentation.instrumentation.execution.phases.ValueConstructionContext.constructParameters(ValueConstructionContext.kt:39) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:94) at org.utbot.instrumentation.instrumentation.execution.UtExecutionInstrumentation.invoke(UtExecutionInstrumentation.kt:53) at org.utbot.instrumentation.process.InstrumentedProcessMainKt$setup$2.invoke(InstrumentedProcessMain.kt:134) at org.utbot.instrumentation.process.InstrumentedProcessMainKt$setup$2.invoke(InstrumentedProcessMain.kt:130) ```Logs:
contest_estimator_output.txt
instrumentation_process_log.txt
utbot_log.txt
Visual proofs (screenshots, logs, images)
Additional context
VM obviously throws exception if array with negative size is trying to be created, and throws exception if requested array bigger that available RAM. It is either should be shown in tests as a result of concrete execution, or fuzzer should be constrained when creating values for array.
Also there is a problem that big array exhaust Instrumented Process memory and OutOfMemoryError
is thrown that prevents from using that process in following concrete execution queries.
Metadata
Metadata
Assignees
Type
Projects
Status