Gzip decompressor throws non-gzip_error
- Dominant language
- C
- Stars
- 48
- Forks
- 124
- PR merge metrics
- No merged PRs in 30d
Description
Compiled with Apple Clang 13.1.6 and boost 1.79. When the input is a non-empty invalid string, then the exception thrown by the decompressor cannot be caught as a gzip_error, even though `e.what()` says so.
```
~> cat gzip_error.cc && echo == && clang++ -v && echo == && clang++ gzip_error.cc -std=c++20 -L /opt/homebrew/opt/boost/lib/ -lboost_iostreams -o gzip_error && echo == && ./gzip_error
#include
#include
#include
#include
#include
using namespace std;
void f(std::string input) {
std::string decompressed;
boost::iostreams::filtering_istream in;
in.push(boost::iostreams::gzip_decompressor());
in.push(boost::iostreams::array_source(input.data(), input.size()));
try {
boost::iostreams::copy(in, boost::iostreams::back_inserter(decompressed));
} catch (const boost::iostreams::gzip_error& e) {
cout << "gzip_error: " << e.what() << endl;
} catch (const std::exception& e) {
cout << "other exception: " << e.what() << endl;
}
}
int main() {
f("");
f("invalid");
return 0;
}
==
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
==
==
gzip_error: gzip error: unspecified iostream_category error
other exception: gzip error: unspecified iostream_category error
```
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by compiling and running the supplied gzip_error.cc reproducer with the stated Apple Clang and Boost versions. Read boost/iostreams/filter/gzip.hpp and the related filtering-stream behavior, then trace why non-empty invalid input reaches the std::exception handler. Done means the invalid-input case is catchable as boost::iostreams::gzip_error while preserving the reported error message.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100