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