Skip to content

Commit 5a14675

Browse files
committed
-
1 parent 97aca26 commit 5a14675

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/test/java/org/xerial/snappy/fuzz/SnappyCombinedFuzzer.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.nio.ByteBuffer;
2929
import java.io.ByteArrayInputStream;
3030
import java.io.ByteArrayOutputStream;
31+
import java.io.IOException;
3132
import java.util.Arrays;
3233

3334
public class SnappyCombinedFuzzer {
@@ -96,9 +97,12 @@ private static void testRawApi(FuzzedDataProvider data) {
9697
});
9798

9899
runFuzz(() -> {
99-
byte[] input = data.consumeBytes(data.consumeInt(0, 4096));
100-
Snappy.isValidCompressedBuffer(input);
101-
Snappy.isValidCompressedBuffer(input, 0, input.length);
100+
try {
101+
byte[] input = data.consumeBytes(data.consumeInt(0, 4096));
102+
Snappy.isValidCompressedBuffer(input);
103+
Snappy.isValidCompressedBuffer(input, 0, input.length);
104+
} catch (IOException e) {
105+
}
102106
});
103107

104108
runFuzz(() -> {
@@ -169,6 +173,7 @@ private static void testFramed(FuzzedDataProvider data) {
169173
try (SnappyFramedInputStream invalidIn = new SnappyFramedInputStream(
170174
new ByteArrayInputStream(data.consumeBytes(100)))) {
171175
while (invalidIn.read() != -1) {}
176+
} catch (IOException e) {
172177
}
173178
});
174179
}
@@ -230,6 +235,7 @@ private static void testBlockStream(FuzzedDataProvider data) {
230235
runFuzz(() -> {
231236
try (SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data.consumeBytes(100)))) {
232237
while (in.read() != -1) {}
238+
} catch (IOException e) {
233239
}
234240
});
235241
}

0 commit comments

Comments
 (0)