File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
selffuzz/src/test/java/com/code_intelligence/selffuzz/mutation
src/main/java/com/code_intelligence/jazzer/mutation/mutator/proto Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 5656
5757 - name : Build & Fuzz
5858 run : |
59- bazelisk run ${{env.BUILD_BUDDY_CONFIG}} --java_runtime_version=remotejdk_${{ matrix.jdk }} ${{ matrix.bazel_args }} ${{ matrix.extra_bazel_args }} //selffuzz/src/test/java/com/code_intelligence/selffuzz/mutation:ArgumentsMutatorFuzzTest --jvmopt=-Xmx10000m -- -runs=1000000
59+ bazelisk run ${{env.BUILD_BUDDY_CONFIG}} --java_runtime_version=remotejdk_${{ matrix.jdk }} ${{ matrix.bazel_args }} ${{ matrix.extra_bazel_args }} //selffuzz/src/test/java/com/code_intelligence/selffuzz/mutation:ArgumentsMutatorFuzzTest -- -runs=1000000
6060
6161 # Notification job that runs after all matrix jobs complete
6262 notification :
Original file line number Diff line number Diff line change @@ -9,6 +9,9 @@ java_fuzz_target_test(
99 "ImmutableBean.java" ,
1010 ],
1111 data = ["//selffuzz/src/test/resources:ArgumentsMutatorFuzzTest-corpus" ],
12+ env = {
13+ "_JAVA_OPTIONS" : "-Xmx1024m" ,
14+ },
1215 fuzzer_args = [
1316 # Make sure that the fuzzer can run. Longer fuzzing runs will be done in a separate GH action.
1417 "-runs=10000" ,
Original file line number Diff line number Diff line change 5757import com .code_intelligence .jazzer .mutation .mutator .lang .LangMutators ;
5858import com .code_intelligence .jazzer .mutation .support .Preconditions ;
5959import com .google .protobuf .Any ;
60+ import com .google .protobuf .CodedInputStream ;
6061import com .google .protobuf .Descriptors .Descriptor ;
6162import com .google .protobuf .Descriptors .EnumDescriptor ;
6263import com .google .protobuf .Descriptors .EnumValueDescriptor ;
8687import java .util .stream .Stream ;
8788
8889public final class BuilderMutatorFactory implements MutatorFactory {
90+
91+ // Generous size limit for decoded protobuf messages. This is necessary to guard against OOM
92+ // errors when the corpus format changes e.g. due to a change in the fuzz test signature.
93+ private static final int MAX_MESSAGE_SIZE = 32 * 1024 * 1024 ; // 32 MiB
94+
8995 private <T extends Builder , U > InPlaceMutator <T > mutatorForField (
9096 AnnotatedType initialType ,
9197 FieldDescriptor field ,
@@ -273,9 +279,11 @@ public B readExclusive(InputStream in) throws IOException {
273279 }
274280
275281 private Builder parseLeniently (InputStream in ) throws IOException {
282+ CodedInputStream cis = CodedInputStream .newInstance (in );
283+ cis .setSizeLimit (MAX_MESSAGE_SIZE );
276284 Builder builder = defaultInstance .toBuilder ();
277285 try {
278- builder .mergeFrom (in );
286+ builder .mergeFrom (cis );
279287 } catch (InvalidProtocolBufferException ignored ) {
280288 // builder has been partially modified with what could be decoded before the parser error.
281289 }
You can’t perform that action at this time.
0 commit comments