Skip to content
Permalink
Browse files
Fix bug on decompression
The uncompressed length was being used where the compressed length was expected.

The particular compression input data that triggered the bug was added to
the eunit test.
  • Loading branch information
fdmanana committed Mar 26, 2011
1 parent d93a8eb commit 8629cad7a52c01e3184b042690a9e8e6435fce95
Showing 2 changed files with 11 additions and 1 deletion.
@@ -130,7 +130,7 @@ extern "C" {
}

bool valid = snappy::RawUncompress(reinterpret_cast<const char *>(input.data),
len,
input.size,
reinterpret_cast<char *>(retBin.data));

(void) valid;
@@ -49,4 +49,14 @@ decompression() ->
{ok, Compressed} = Result,

?assertEqual({ok, Data}, snappy:decompress(Compressed)),

BigData = <<"mVPZzfDzKNeZrh1QdkMEgh2U0Bv2i3+bLJaCqgNibXuMuwfjrqTuxPGupxjI",
"xEbuYR+u/KZvSDhoxnkpPbgJo7oiQv2ibDrrGZx7RDs3Nn7Ww51B7+zUL4tr",
"G+16TlJilJT47Z4cQn8EpWex2bMRFAoJ6AMJAodLGbiD78yUyIorRKVcCa+k",
"udzjsqYAoXzW/z8JCB6rbGGSbnLyqztR//ch5sRwSvYARlV+IamzBkDXFZxj",
"5TAwAl2ZcbCeMX0qgXX4EonVZxc=">>,
Result2 = snappy:compress(BigData),
?assertMatch({ok, _}, Result2),
{ok, Compressed2} = Result2,
?assertEqual({ok, BigData}, snappy:decompress(Compressed2)),
ok.

0 comments on commit 8629cad

Please sign in to comment.