about summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/compression.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libutil/compression.cc b/src/libutil/compression.cc
index 8ffd55efb23c..11eec7a7bc20 100644
--- a/src/libutil/compression.cc
+++ b/src/libutil/compression.cc
@@ -49,6 +49,9 @@ static ref<std::string> decompressXZ(const std::string & in)
 
         if (ret != LZMA_OK)
             throw Error("error while decompressing xz file");
+
+        if (strm.avail_in == 0)
+            throw Error("xz data ends prematurely");
     }
 }
 
@@ -86,6 +89,9 @@ static ref<std::string> decompressBzip2(const std::string & in)
 
         if (ret != BZ_OK)
             throw Error("error while decompressing bzip2 file");
+
+        if (strm.avail_in == 0)
+            throw Error("bzip2 data ends prematurely");
     }
 }