Skip to content

Commit e6a1312

Browse files
authored
apache-commons-compress: Adding coverage for DUMP and Pack200 formats (COMPRESS-632) (#11616)
This PR adds support for DUMP and COMPRESS formats. This work is being tracked on the project side here: https://issues.apache.org/jira/browse/COMPRESS-632
1 parent 2144b19 commit e6a1312

File tree

3 files changed

+63
-0
lines changed

3 files changed

+63
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
////////////////////////////////////////////////////////////////////////////////
16+
17+
import org.apache.commons.compress.archivers.ArchiveException;
18+
import org.apache.commons.compress.archivers.dump.DumpArchiveInputStream;
19+
20+
import java.io.ByteArrayInputStream;
21+
import java.io.IOException;
22+
23+
public class ArchiverDumpFuzzer extends BaseTests {
24+
public static void fuzzerTestOneInput(byte[] data) {
25+
try {
26+
fuzzArchiveInputStream(new DumpArchiveInputStream(new ByteArrayInputStream(data)));
27+
} catch (ArchiveException|IOException ignored) {
28+
}
29+
}
30+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2024 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
////////////////////////////////////////////////////////////////////////////////
16+
17+
import org.apache.commons.compress.compressors.pack200.Pack200CompressorInputStream;
18+
19+
import java.io.ByteArrayInputStream;
20+
import java.io.IOException;
21+
22+
public class CompressorPack200Fuzzer extends BaseTests {
23+
public static void fuzzerTestOneInput(byte[] data) {
24+
try {
25+
fuzzCompressorInputStream(new Pack200CompressorInputStream(new ByteArrayInputStream(data)));
26+
} catch (IOException ignored) {
27+
}
28+
}
29+
}

projects/apache-commons-compress/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ RUN \
4747
zip -j0 $SRC/ArchiverArjFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.arj && \
4848
zip -j0 $SRC/ArchiverCpioFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.cpio && \
4949
zip -uj0 $SRC/ArchiverCpioFuzzer_seed_corpus.zip commons-compress/src/test/resources/archives/*.cpio && \
50+
zip -j0 $SRC/ArchiverDumpFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.dump && \
51+
zip -uj0 $SRC/ArchiverDumpFuzzer_seed_corpus.zip commons-compress/src/test/resources/org/apache/commons/compress/dump/*.dump && \
5052
zip -j0 $SRC/CompressSevenZFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.7z && \
5153
zip -uj0 $SRC/CompressTarFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.tar && \
5254
zip -uj0 $SRC/CompressTarFuzzer_seed_corpus.zip commons-compress/src/test/resources/archives/*.tar && \
@@ -59,6 +61,8 @@ RUN \
5961
zip -j0 $SRC/CompressorDeflate64Fuzzer_seed_corpus.zip commons-compress/src/test/resources/*.deflate && \
6062
zip -uj0 $SRC/CompressorGzipFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.gz && \
6163
zip -j0 $SRC/CompressorLZ4Fuzzer_seed_corpus.zip commons-compress/src/test/resources/*lz4 && \
64+
zip -j0 $SRC/CompressorPack200Fuzzer_seed_corpus.zip commons-compress/src/test/resources/*.pack && \
65+
zip -uj0 $SRC/CompressorPack200Fuzzer_seed_corpus.zip commons-compress/src/test/resources/pack200/*.pack && \
6266
zip -uj0 $SRC/CompressorSnappyFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.sz && \
6367
zip -j0 $SRC/CompressorZFuzzer_seed_corpus.zip commons-compress/src/test/resources/*.Z
6468

0 commit comments

Comments
 (0)