(context: school assignment)
I've been provided with a program to test, and when messing around with it's inputs manually, I can make it error (example, index out of bounds)
However, when trying to crash it through ProcessBuilder (which was suggested as the way to build the fuzztester) I can't get a different output between crash/nocrash/ Everything looks identical. The exit code is always 1, the error stream is identical, I can't figure out a way to tell the difference between it resolving properly and not.
I'm sure that processbuilder can do this, but I just can't figure out what method I'm missing that gives this a distinct output.
Here's the code I'm using right now, I haven't done any fuzzing, just trying to get the error detection going first since nothing works without that.
import java.lang.ProcessBuilder;
public class testRunner {
public static void main(String[] args) {
try {
ProcessBuilder processBuilder = new ProcessBuilder("java", "PacketLab", "input.txt");
Process process = processBuilder.start();
process.waitFor();
System.out.println("exit code: " + process.exitValue());
System.out.println("errorStream: " + process.getErrorStream());
}
catch(Exception e) {
System.out.println("caught error: " + e);
}
}
}```
If I run this with valid inputs in input.txt, it outputs exactly the same exit code and errorStream as if I use invalid inputs in input.txt. But I know that if I manually run PacketLab with those inputs, it gives me an error, for example, the last time I did this, it gave this:
```Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
at PacketLab.process(PacketLab.java:130)
at PacketLab.main(PacketLab.java:41)```