summaryrefslogtreecommitdiffstats
path: root/examples/frameCompress.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-08-21 11:44:24 (GMT)
committerYann Collet <cyan@fb.com>2019-08-21 11:44:24 (GMT)
commit28964f4bea7fa95dc76154c5190d77fc18b2f8c8 (patch)
treeac8c4a7d39c44fd177298ad89ccfbfd3c2e06bf0 /examples/frameCompress.c
parent09d9f27b0a86f2c3dfd3e1a81e97069c378ea4d7 (diff)
downloadlz4-28964f4bea7fa95dc76154c5190d77fc18b2f8c8.zip
lz4-28964f4bea7fa95dc76154c5190d77fc18b2f8c8.tar.gz
lz4-28964f4bea7fa95dc76154c5190d77fc18b2f8c8.tar.bz2
fixed #778
fixed assert() when divisor == 0
Diffstat (limited to 'examples/frameCompress.c')
-rw-r--r--examples/frameCompress.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/frameCompress.c b/examples/frameCompress.c
index a189329..aac4a3b 100644
--- a/examples/frameCompress.c
+++ b/examples/frameCompress.c
@@ -32,12 +32,12 @@ static void safe_fwrite(void* buf, size_t eltSize, size_t nbElt, FILE* f)
{
size_t const writtenSize = fwrite(buf, eltSize, nbElt, f);
size_t const expectedSize = eltSize * nbElt;
- assert(expectedSize / nbElt == eltSize); /* check overflow */
+ if (nbElt>0) assert(expectedSize / nbElt == eltSize); /* check overflow */
if (writtenSize < expectedSize) {
if (ferror(f)) /* note : ferror() must follow fwrite */
fprintf(stderr, "Write failed \n");
else
- fprintf(stderr, "Short write \n");
+ fprintf(stderr, "Write too short \n");
exit(1);
}
}