summaryrefslogtreecommitdiff
path: root/src/decompress_z.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/decompress_z.cc')
-rw-r--r--src/decompress_z.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/decompress_z.cc b/src/decompress_z.cc
index f9f87ae..e888e77 100644
--- a/src/decompress_z.cc
+++ b/src/decompress_z.cc
@@ -62,9 +62,16 @@ class DecompressReader : public io::Reader {
if (!in_eof_)
buffer_->consume(stream_.next_in - rptr);
} else {
- return std::unexpected(
- ret == Z_DATA_ERROR
- ? io::ReadError::InvalidData : io::ReadError::Error);
+ switch (ret) {
+ case Z_DATA_ERROR:
+ return std::unexpected(io::ReadError::InvalidData);
+ case Z_BUF_ERROR:
+ // Tricky, could also be because of too little input.
+ // TODO: Improve logic here if we can
+ return std::unexpected(io::ReadError::MaxTooSmall);
+ default:
+ return std::unexpected(io::ReadError::Error);
+ }
}
return got;
}