Skip to content

Commit 209fa1a

Browse files
committed
update tests
1 parent 0593eaa commit 209fa1a

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

java/ql/test/experimental/query-tests/security/CWE-522-DecompressionBombs/SnappyHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public class SnappyHandler {
1010
public static void SnappyZipInputStream(InputStream inputStream) throws IOException {
1111
int readLen;
1212
byte[] readBuffer = new byte[4096];
13-
try (SnappyInputStream zipInputStream = new SnappyInputStream(inputStream)) { // $ hasTaintFlow="inputStream"
13+
try (SnappyInputStream zipInputStream = new SnappyInputStream(inputStream)) {
1414
try (OutputStream outputStream = Files.newOutputStream(Paths.get("extractedFile"))) {
1515
while ((readLen = zipInputStream.read(readBuffer)) != -1) { // $ hasTaintFlow="zipInputStream"
1616
outputStream.write(readBuffer, 0, readLen);

java/ql/test/experimental/query-tests/security/CWE-522-DecompressionBombs/ZipHandler.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public static void ZipInputStreamSafe(InputStream inputStream) throws IOExceptio
2424
// FileInputStream fis = new FileInputStream(filename);
2525
CRC32 checkSum = new CRC32();
2626
CheckedInputStream gzis = new CheckedInputStream(inputStream, checkSum);
27-
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream))) { // $ hasTaintFlow="new BufferedInputStream(...)"
27+
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream))) {
2828
ZipEntry entry;
2929
int entries = 0;
3030
long total = 0;
@@ -63,7 +63,7 @@ public static void ZipInputStreamSafe2(InputStream inputStream) throws IOExcepti
6363
int BUFFER = 512;
6464
int TOOBIG = 100 * 1024 * 1024; // 100MB
6565
// FileInputStream fis = new FileInputStream(filename);
66-
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream))) { // $ hasTaintFlow="new BufferedInputStream(...)"
66+
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream))) {
6767
ZipEntry entry;
6868
while ((entry = zis.getNextEntry()) != null) {
6969
System.out.println("Extracting: " + entry);
@@ -91,7 +91,7 @@ public static void ZipInputStreamSafe2(InputStream inputStream) throws IOExcepti
9191
public static void ZipInputStreamUnsafe(InputStream inputStream) throws IOException {
9292
int BUFFER = 512;
9393
// FileInputStream fis = new FileInputStream(filename);
94-
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream))) { // $ hasTaintFlow="new BufferedInputStream(...)"
94+
try (ZipInputStream zis = new ZipInputStream(new BufferedInputStream(inputStream))) {
9595
ZipEntry entry;
9696
while ((entry = zis.getNextEntry()) != null) {
9797
System.out.println("Extracting: " + entry);
@@ -112,7 +112,7 @@ public static void ZipInputStreamUnsafe(InputStream inputStream) throws IOExcept
112112

113113
public static void GZipInputStreamUnsafe(InputStream inputStream) throws IOException {
114114
int BUFFER = 512;
115-
try (GZIPInputStream gzis = new GZIPInputStream(inputStream)) { // $ hasTaintFlow="inputStream"
115+
try (GZIPInputStream gzis = new GZIPInputStream(inputStream)) {
116116
int count;
117117
byte[] data = new byte[BUFFER];
118118
FileOutputStream fos = new FileOutputStream("/tmp/tmp");
@@ -127,7 +127,7 @@ public static void GZipInputStreamUnsafe(InputStream inputStream) throws IOExcep
127127

128128
public static void InflaterInputStreamUnsafe(InputStream inputStream) throws IOException {
129129
int BUFFER = 512;
130-
try (InflaterInputStream Izis = new InflaterInputStream(inputStream)) { // $ hasTaintFlow="inputStream"
130+
try (InflaterInputStream Izis = new InflaterInputStream(inputStream)) {
131131
int count;
132132
byte[] data = new byte[BUFFER];
133133
FileOutputStream fos = new FileOutputStream("/tmp/tmp");
@@ -156,7 +156,7 @@ public static void InflaterUnsafe(byte[] inputBytes) throws DataFormatException,
156156
public static void ZipFile1(String zipFilePath) throws DataFormatException, IOException {
157157
try {
158158
System.out.println("zipFilePath = " + zipFilePath);
159-
ZipFile zipFile = new ZipFile(zipFilePath); // $ hasTaintFlow="zipFilePath"
159+
ZipFile zipFile = new ZipFile(zipFilePath);
160160
Enumeration<? extends ZipEntry> entries = zipFile.entries();
161161
while (entries.hasMoreElements()) {
162162
ZipEntry entry = entries.nextElement();

0 commit comments

Comments
 (0)