1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.bcel;
20
21 import static org.junit.jupiter.api.Assertions.assertThrows;
22
23 import java.io.File;
24 import java.io.FileInputStream;
25
26 import org.apache.bcel.classfile.ClassFormatException;
27 import org.apache.bcel.classfile.ClassParser;
28 import org.junit.jupiter.api.Test;
29
30 class OssFuzzTest {
31
32 @Test
33 void testIssue51980() throws Exception {
34 testOssFuzzReproducer("51980");
35 }
36
37 @Test
38 void testIssue51989() throws Exception {
39 testOssFuzzReproducer("51989");
40 }
41
42 @Test
43 void testIssue52168() throws Exception {
44 testOssFuzzReproducer("52168");
45 }
46
47 @Test
48 void testIssue53543() throws Exception {
49 testOssFuzzReproducer("53543");
50 }
51
52
53
54
55 @Test
56 void testIssue53544a() throws Exception {
57 testOssFuzzReproducer("53544a");
58 }
59
60 @Test
61 void testIssue53620() throws Exception {
62 testOssFuzzReproducer("53620");
63 }
64
65 @Test
66 void testIssue53676() throws Exception {
67 testOssFuzzReproducer("53676");
68 }
69
70 @Test
71 void testIssue54119() throws Exception {
72 testOssFuzzReproducer("54119");
73 }
74
75 @Test
76 void testIssue54254() throws Exception {
77 testOssFuzzReproducer("54254");
78 }
79
80 private void testOssFuzzReproducer(final String issue) throws Exception {
81
82 final File reproducerFile = new File("target/test-classes/ossfuzz/issue" + issue + "/Test.classx");
83 try (FileInputStream reproducerInputStream = new FileInputStream(reproducerFile)) {
84 final ClassParser cp = new ClassParser(reproducerInputStream, "Test");
85 assertThrows(ClassFormatException.class, () -> cp.parse());
86 }
87 }
88 }