![]() | |||||||||||||
Messages in this thread Patch in this message |
The cryptoapi deflate module currently returns an error when it
successfully handles a full page of data at the end of a compressed stream.
This patch addresses that behaviour.
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
crypto/deflate.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/crypto/deflate.c b/crypto/deflate.c
index f209368..2a38593 100644
--- a/crypto/deflate.c
+++ b/crypto/deflate.c
@@ -142,8 +142,15 @@ static int deflate_compress(void *ctx, c
ret = zlib_deflate(stream, Z_FINISH);
if (ret != Z_STREAM_END) {
- ret = -EINVAL;
- goto out;
+ if (!(ret == Z_OK && !stream->avail_in && !stream->avail_out)) {
+ ret = -EINVAL;
+ goto out;
+ } else {
+ u8 zerostuff = 0;
+ stream->next_out = &zerostuff;
+ stream->avail_out = 1;
+ ret = zlib_deflate(stream, Z_FINISH);
+ }
}
ret = 0;
*dlen = stream->total_out;
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
| ||||||||||||
| Last update: 2006-06-26 18:54 [from the cache] ©2003-2008 | |||||||||||||