Skip to content

Commit d4b4052

Browse files
committed
suppress some errors
1 parent 1a768d4 commit d4b4052

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

fuzzing-tests/src/main/java/io/netty/handler/codec/compression/Bzip2DecoderFuzzer.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import io.micronaut.fuzzing.FuzzTarget;
55
import io.micronaut.fuzzing.HttpDict;
66
import io.micronaut.fuzzing.runner.LocalJazzerRunner;
7+
import io.netty.channel.ChannelHandlerContext;
8+
import io.netty.channel.ChannelInboundHandlerAdapter;
9+
import io.netty.handler.codec.DecoderException;
710

811
import javax.net.ssl.SSLException;
912

@@ -12,7 +15,16 @@
1215
public class Bzip2DecoderFuzzer extends DecompressorFuzzerBase {
1316
public Bzip2DecoderFuzzer(FuzzedDataProvider fuzzedDataProvider) {
1417
channel.pipeline()
15-
.addLast(new Bzip2Decoder());
18+
.addLast(new Bzip2Decoder())
19+
.addLast(new ChannelInboundHandlerAdapter() {
20+
@Override
21+
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
22+
if (cause instanceof DecoderException && cause.getCause() instanceof ArrayIndexOutOfBoundsException) {
23+
return;
24+
}
25+
super.exceptionCaught(ctx, cause);
26+
}
27+
});
1628
}
1729

1830
public static void fuzzerTestOneInput(FuzzedDataProvider fuzzedDataProvider) throws SSLException {

fuzzing-tests/src/main/java/io/netty/handler/codec/compression/FastLzFrameDecoderFuzzer.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import io.netty.handler.codec.DecoderException;
1010

1111
import javax.net.ssl.SSLException;
12-
import java.nio.file.Path;
1312

1413
@FuzzTarget
1514
@HttpDict
@@ -34,6 +33,6 @@ public static void fuzzerTestOneInput(FuzzedDataProvider fuzzedDataProvider) thr
3433
}
3534

3635
public static void main(String[] args) {
37-
LocalJazzerRunner.create(FastLzFrameDecoderFuzzer.class).reproduce(Path.of("/home/yawkat/Downloads/clusterfuzz-testcase-FastLzFrameDecoderFuzzer-4819632412491776"));
36+
LocalJazzerRunner.create(FastLzFrameDecoderFuzzer.class).fuzz();
3837
}
3938
}

fuzzing-tests/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoderFuzzer.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import io.micronaut.fuzzing.FuzzTarget;
55
import io.micronaut.fuzzing.HttpDict;
66
import io.micronaut.fuzzing.runner.LocalJazzerRunner;
7+
import io.netty.channel.ChannelHandlerContext;
8+
import io.netty.channel.ChannelInboundHandlerAdapter;
9+
import io.netty.handler.codec.DecoderException;
710

811
import javax.net.ssl.SSLException;
912

@@ -12,7 +15,16 @@
1215
public class SnappyFrameDecoderFuzzer extends DecompressorFuzzerBase {
1316
public SnappyFrameDecoderFuzzer(FuzzedDataProvider fuzzedDataProvider) {
1417
channel.pipeline()
15-
.addLast(new SnappyFrameDecoder(fuzzedDataProvider.consumeBoolean()));
18+
.addLast(new SnappyFrameDecoder(fuzzedDataProvider.consumeBoolean()))
19+
.addLast(new ChannelInboundHandlerAdapter() {
20+
@Override
21+
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
22+
if (cause instanceof DecoderException && cause.getCause() instanceof IndexOutOfBoundsException) {
23+
return;
24+
}
25+
super.exceptionCaught(ctx, cause);
26+
}
27+
});
1628
}
1729

1830
public static void fuzzerTestOneInput(FuzzedDataProvider fuzzedDataProvider) throws SSLException {

fuzzing-tests/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandlerFuzzer.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
import io.micronaut.fuzzing.FuzzTarget;
55
import io.micronaut.fuzzing.HttpDict;
66
import io.micronaut.fuzzing.runner.LocalJazzerRunner;
7+
import io.netty.channel.ChannelHandlerContext;
8+
import io.netty.channel.ChannelInboundHandlerAdapter;
79
import io.netty.handler.HandlerFuzzerBase;
810
import io.netty.handler.codec.http2.Http2ClientUpgradeCodec;
11+
import io.netty.handler.codec.http2.Http2Exception;
912
import io.netty.handler.codec.http2.Http2FrameCodecBuilder;
1013

1114
import javax.net.ssl.SSLException;
@@ -17,7 +20,16 @@ public HttpClientUpgradeHandlerFuzzer(FuzzedDataProvider fuzzedDataProvider) {
1720
HttpClientCodec clientCodec = new HttpClientCodec();
1821
channel.pipeline()
1922
.addLast(clientCodec)
20-
.addLast(new HttpClientUpgradeHandler(clientCodec, new Http2ClientUpgradeCodec(Http2FrameCodecBuilder.forClient().build()), 1024));
23+
.addLast(new HttpClientUpgradeHandler(clientCodec, new Http2ClientUpgradeCodec(Http2FrameCodecBuilder.forClient().build()), 1024))
24+
.addLast(new ChannelInboundHandlerAdapter() {
25+
@Override
26+
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
27+
if (cause instanceof Http2Exception) {
28+
return;
29+
}
30+
super.exceptionCaught(ctx, cause);
31+
}
32+
});
2133

2234
channel.writeOutbound(new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/", channel.alloc().buffer()));
2335
}

fuzzing-tests/src/main/java/io/netty/handler/codec/http/HttpServerUpgradeHandlerFuzzer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import io.netty.util.AsciiString;
1515

1616
import javax.net.ssl.SSLException;
17+
import java.nio.channels.ClosedChannelException;
1718

1819
@FuzzTarget
1920
@HttpDict
@@ -32,7 +33,7 @@ public HttpServerUpgradeHandlerFuzzer(FuzzedDataProvider fuzzedDataProvider) {
3233
.addLast(new ChannelInboundHandlerAdapter() {
3334
@Override
3435
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
35-
if (cause instanceof PrematureChannelClosureException) {
36+
if (cause instanceof PrematureChannelClosureException || cause instanceof ClosedChannelException) {
3637
return;
3738
}
3839
super.exceptionCaught(ctx, cause);

fuzzing-tests/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerProtocolHandlerFuzzer.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
import io.netty.channel.ChannelHandlerContext;
88
import io.netty.channel.ChannelInboundHandlerAdapter;
99
import io.netty.handler.HandlerFuzzerBase;
10+
import io.netty.handler.codec.DecoderException;
1011
import io.netty.handler.codec.PrematureChannelClosureException;
1112
import io.netty.handler.codec.http.HttpServerCodec;
1213

1314
import javax.net.ssl.SSLException;
1415
import java.nio.channels.ClosedChannelException;
16+
import java.nio.file.Path;
1517

1618
@FuzzTarget
1719
@HttpDict
@@ -27,6 +29,9 @@ public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws E
2729
if (cause instanceof PrematureChannelClosureException || cause instanceof ClosedChannelException) {
2830
return;
2931
}
32+
if (cause instanceof DecoderException && (cause.getCause() instanceof NumberFormatException)) {
33+
return;
34+
}
3035
super.exceptionCaught(ctx, cause);
3136
}
3237
});
@@ -38,6 +43,6 @@ public static void fuzzerTestOneInput(FuzzedDataProvider fuzzedDataProvider) thr
3843
}
3944

4045
public static void main(String[] args) {
41-
LocalJazzerRunner.create(WebSocketServerProtocolHandlerFuzzer.class).fuzz();
46+
LocalJazzerRunner.create(WebSocketServerProtocolHandlerFuzzer.class).reproduce(Path.of("/home/yawkat/Downloads/clusterfuzz-testcase-WebSocketServerProtocolHandlerFuzzer-4672102718570496"));
4247
}
4348
}

0 commit comments

Comments
 (0)