|
20 | 20 |
|
21 | 21 | import com.code_intelligence.jazzer.api.FuzzedDataProvider; |
22 | 22 | import com.code_intelligence.jazzer.junit.FuzzTest; |
23 | | -import com.code_intelligence.jazzer.mutation.annotation.WithSize; |
24 | | -import com.code_intelligence.jazzer.mutation.annotation.WithUtf8Length; |
25 | 23 | import com.code_intelligence.jazzer.protobuf.Proto2; |
26 | 24 | import com.code_intelligence.jazzer.protobuf.Proto3; |
27 | 25 | import com.code_intelligence.selffuzz.jazzer.mutation.ArgumentsMutator; |
28 | 26 | import com.code_intelligence.selffuzz.jazzer.mutation.annotation.NotNull; |
29 | 27 | import com.code_intelligence.selffuzz.jazzer.mutation.annotation.WithLength; |
| 28 | +import com.code_intelligence.selffuzz.jazzer.mutation.annotation.WithSize; |
| 29 | +import com.code_intelligence.selffuzz.jazzer.mutation.annotation.WithUtf8Length; |
30 | 30 | import com.code_intelligence.selffuzz.jazzer.mutation.mutator.Mutators; |
31 | 31 | import java.io.ByteArrayInputStream; |
32 | 32 | import java.io.ByteArrayOutputStream; |
@@ -102,21 +102,32 @@ void fuzzStrings( |
102 | 102 | @NotNull String s1, |
103 | 103 | @NotNull @WithUtf8Length(min = 10, max = 20) String s2) {} |
104 | 104 |
|
105 | | - @SelfFuzzTest // BUG: null pointer exception |
106 | | - void fuzzListOfMaps(Map<String, Integer> nullableMap) {} |
| 105 | + @SelfFuzzTest |
| 106 | + void fuzzListOfMaps(@WithSize(max = 4) Map<String, Integer> nullableMap) { |
| 107 | + if (nullableMap != null) { |
| 108 | + assertThat(nullableMap.size()).isAtMost(4); |
| 109 | + } |
| 110 | + } |
107 | 111 |
|
108 | 112 | @SelfFuzzTest |
109 | 113 | void fuzzListOfLists(List<@NotNull List<String>> nullableMap, List<List<Integer>> nullableList) {} |
110 | 114 |
|
111 | 115 | @SelfFuzzTest |
112 | | - void fuzzPPrimitiveArrays( |
113 | | - int @WithLength(max = 10) [] a0, boolean[] a2, int @WithLength(max = 8193) [] a3) {} |
| 116 | + void fuzzPrimitiveArrays( |
| 117 | + int @WithLength(max = 10) [] a0, boolean[] a2, int @WithLength(max = 8193) [] a3) { |
| 118 | + if (a0 != null) assertThat(a0.length).isAtMost(10); |
| 119 | + if (a3 != null) assertThat(a3.length).isAtMost(8193); |
| 120 | + } |
114 | 121 |
|
115 | 122 | @SelfFuzzTest |
116 | 123 | void fuzzBean(@NotNull ConstructorPropertiesAnnotatedBean bean, BeanWithParent beanWithParent) {} |
117 | 124 |
|
118 | 125 | @SelfFuzzTest |
119 | | - void fuzzListOfBeans(@WithSize(max = 4) List<BeanWithParent> beanWithParent) {} |
| 126 | + void fuzzListOfBeans(@WithSize(max = 4) List<BeanWithParent> beanWithParent) { |
| 127 | + if (beanWithParent != null) { |
| 128 | + assertThat(beanWithParent.size()).isAtMost(4); |
| 129 | + } |
| 130 | + } |
120 | 131 |
|
121 | 132 | @SelfFuzzTest |
122 | 133 | void fuzzListOfListOfBeans( |
@@ -189,7 +200,15 @@ void fuzzPrimitiveArrays( |
189 | 200 | Byte @WithLength(max = 3) [] by0, |
190 | 201 | byte[] by1, |
191 | 202 | Short @WithLength(max = 3) [] s0, |
192 | | - short[] s1) {} |
| 203 | + short[] s1) { |
| 204 | + if (i0 != null) assertThat(i0.length).isAtMost(3); |
| 205 | + if (b0 != null) assertThat(b0.length).isAtMost(3); |
| 206 | + if (d0 != null) assertThat(d0.length).isAtMost(3); |
| 207 | + if (f0 != null) assertThat(f0.length).isAtMost(3); |
| 208 | + if (l0 != null) assertThat(l0.length).isAtMost(3); |
| 209 | + if (by0 != null) assertThat(by0.length).isAtMost(3); |
| 210 | + if (s0 != null) assertThat(s0.length).isAtMost(3); |
| 211 | + } |
193 | 212 |
|
194 | 213 | enum MyEnum { |
195 | 214 | A, |
|
0 commit comments