I've stumbled into this in https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=52989&q=label%3AProj-librawspeed
which manifested as an obscure leak, and originated from a seemingly simple refactoring:
https://github.com/darktable-org/rawspeed/commit/1fd09b9cffbddc65753eb523f7ba5528d35fe34d#diff-c832cc8366d36ca1165ecef7f4a256a2643ec09c4405a1238222a4529df619a1R172-R174
Reduced, this should look like: (actual repro in progress)
#include <vector>
std::vector<int> handle() {
std::vector<int> v(42, 42); // this somehow leaks
return v;
}
__attribute__((pure)) // double yikes
std::vector<int> footgun(int argc) {
std::vector<int> v(24, 24);
if(argc != 42)
throw int(0); // yikes
return v;
}
int main(int argc, char* argv[]) {
try {
auto v = handle();
auto v2 = footgun(argc);
} catch(...) {}
return 0;
}https://godbolt.org/z/zdavdKnfa
Surprisingly, we did not handle it before.
I'm not yet sure if we can pretty-print the actual exception on compiler-rt side.
(I may need to update a couple tests still)
