aboutsummaryrefslogtreecommitdiffstats
path: root/lzo
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-05-31 22:23:11 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-05-31 22:23:11 -0700
commitbd64b523111fd75861e1856a459d39de0ecddc48 (patch)
tree62e1c7166d6b0161999a5c41e16a5e411b1e73f6 /lzo
parentf502c307fcace74e8c99774112016150e8a7a01a (diff)
downloadlwip-bd64b523111fd75861e1856a459d39de0ecddc48.tar.gz
lwip-bd64b523111fd75861e1856a459d39de0ecddc48.tar.xz
lwip-bd64b523111fd75861e1856a459d39de0ecddc48.zip
prepcore: actually do a full binary comparison on the output end
Do a full binary comparison between the decompressed output and what we started with. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'lzo')
-rw-r--r--lzo/prepcore.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/lzo/prepcore.c b/lzo/prepcore.c
index bbf0154f..cb6b483a 100644
--- a/lzo/prepcore.c
+++ b/lzo/prepcore.c
@@ -144,6 +144,8 @@ int __lzo_cdecl_main main(int argc, char *argv[])
lzo_uint out_len = 0;
lzo_uint outfile_len;
+ lzo_bytep test;
+
lzo_byte wrkmem[LZO1X_999_MEM_COMPRESS];
lzo_uint best_len;
@@ -330,16 +332,16 @@ int __lzo_cdecl_main main(int argc, char *argv[])
* Step 12: verify decompression
*/
#ifdef PARANOID
- memset(in, 0, in_len); /* paranoia - clear output buffer */
- orig_len = in_len;
- r = lzo1x_decompress_safe(out, out_len, in, &orig_len, NULL);
+ test = calloc(in_len,2);
+ orig_len = in_len*2;
+ r = lzo1x_decompress_safe(out, out_len, test, &orig_len, NULL);
+
if (r != LZO_E_OK || orig_len != in_len) {
/* this should NEVER happen */
printf("internal error - decompression failed: %d\n", r);
exit(1);
}
- if (uncompressed_checksum !=
- lzo_adler32(lzo_adler32(0, NULL, 0), in, in_len)) {
+ if (memcmp(test, in, in_len)) {
/* this should NEVER happen */
printf("internal error - decompression data error\n");
exit(1);
@@ -347,6 +349,8 @@ int __lzo_cdecl_main main(int argc, char *argv[])
/* Now you could also verify decompression under similar conditions as in
* your application, e.g. overlapping assembler decompression etc.
*/
+
+ free(test);
#endif
free(infile);