diff --git a/panda/src/downloader/decompressor.cxx b/panda/src/downloader/decompressor.cxx index 9b42ec1791..be65a173d6 100644 --- a/panda/src/downloader/decompressor.cxx +++ b/panda/src/downloader/decompressor.cxx @@ -261,6 +261,12 @@ decompress(Filename &source_file, Filename &dest_file) { // Determine source file length read_stream.seekg(0, ios::end); int source_file_length = read_stream.tellg(); + if (source_file_length == 0) { + downloader_cat.warning() + << "Decompressor::decompress() - Zero length file: " + << source_file << endl; + return true; + } read_stream.seekg(0, ios::beg); // Open destination file diff --git a/panda/src/downloadertools/pcompress.cxx b/panda/src/downloadertools/pcompress.cxx index e377ef2144..0540fbe804 100644 --- a/panda/src/downloadertools/pcompress.cxx +++ b/panda/src/downloadertools/pcompress.cxx @@ -27,6 +27,11 @@ main(int argc, char *argv[]) { int source_file_length = read_stream.tellg(); read_stream.seekg(0, ios::beg); + if (source_file_length == 0) { + cerr << "zero length file: " << source_file << endl; + return 1; + } + // Open destination file ofstream write_stream; dest_file.set_binary();