Permalink
Browse files

bugfix: prevent LzoDecompressor from entering endless loop when a emp…

…ty lzo file comes.
  • Loading branch information...
1 parent 552b3f9 commit f1d7661e38a7f10da46f817111745966ce71617e @angushe committed Dec 3, 2010
@@ -297,6 +297,9 @@ public synchronized int decompress(byte[] b, int off, int len)
// Check if there is data to decompress
if (compressedDirectBufLen <= 0) {
+ if (userBufLen <= 0 ) {
+ finished = true;
+ }
return 0;
}
@@ -43,6 +43,7 @@
private final String bigFile = "100000.txt";
private final String mediumFile = "1000.txt";
private final String smallFile = "100.txt";
+ private final String emptyFile = "0.txt";
@Override
protected void setUp() throws Exception {
@@ -81,6 +82,14 @@ public void testSmallFile() throws NoSuchAlgorithmException, IOException,
runTest(smallFile);
}
+ /**
+ * Test against a 0 line file.
+ */
+ public void testEmptyFile() throws NoSuchAlgorithmException, IOException,
+ InterruptedException {
+ runTest(emptyFile);
+ }
+
/**
* Test that reading an lzo-compressed file produces the same lines as reading the equivalent
* flat file. The test opens both the compressed and flat file, successively reading each
View
No changes.
View
Binary file not shown.

0 comments on commit f1d7661

Please sign in to comment.