Don't hang in decompression if bzip2 data ends prematurely

This commit is contained in:
Eelco Dolstra 2017-03-21 19:20:21 +01:00
parent aa23bba27f
commit ed5c0f69f2
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -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");
}
}