Merge pull request from GHSA-55g7-9cwv-5qfv · xerial/snappy-java@9f8c3cf (original) (raw)
`@@ -379,6 +379,24 @@ public void isInvalidChunkLengthForSnappyInputStreamOutOfMemory()
`
379
379
` }
`
380
380
` }
`
381
381
``
``
382
`+
/*
`
``
383
`+
Tests sad cases for SnappyInputStream.read method
`
``
384
`+
- Expects a failed to compress exception due to upper bounds chunk size
`
``
385
`+
- {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0,(byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff}
`
``
386
`+
*/
`
``
387
`+
@Test
`
``
388
`+
public void isInvalidChunkLengthForSnappyInputStream()
`
``
389
`+
throws Exception {
`
``
390
`+
byte[] data = {-126, 'S', 'N', 'A', 'P', 'P', 'Y', 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 0x7f, (byte) 0xff, (byte) 0xff, (byte) 0xff};
`
``
391
`+
SnappyInputStream in = new SnappyInputStream(new ByteArrayInputStream(data));
`
``
392
`+
byte[] out = new byte[50];
`
``
393
`+
try {
`
``
394
`+
in.read(out);
`
``
395
`+
} catch (SnappyError error) {
`
``
396
`+
Assert.assertEquals(error.errorCode, SnappyErrorCode.FAILED_TO_UNCOMPRESS);
`
``
397
`+
}
`
``
398
`+
}
`
``
399
+
382
400
`/*
`
383
401
` Tests happy cases for BitShuffle.shuffle method
`
384
402
` - double: 0, 10
`