walker1011 / snappy

Automatically exported from code.google.com/p/snappy
Other
0 stars 0 forks source link

bad_alloc exception not caught in snappy.cc::Compress #94

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Snappy currently doesn't seem to handle out of memory situations, is there a 
plan to make it more robust to allocation failures? Thanks.

What steps will reproduce the problem?
1. throw a "bad_alloc" in place of any "new char[...]" in Compress in snappy.cc
2. call snappy_compress using the built-in C interface
3.

What is the expected output? What do you see instead?
a std::bad_alloc exception is thrown

What version of the product are you using? On what operating system?
Snappy 1.1.2, Windows Server 2012 R2

Please provide any additional information below.

Original issue reported on code.google.com by robert....@10gen.com on 27 Feb 2015 at 4:40

GoogleCodeExporter commented 9 years ago
Hi,

If you wish to, you can check the number of uncompressed bytes before 
decompression, which will guard you against most such cases. If you really are 
afraid that any random small allocation could fail, then you should use the C++ 
interface; this is fairly obscure and there are no plans to look into it.

Original comment by se...@google.com on 23 Jun 2015 at 11:04