]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix the error which Clang Static Analyzer says "Division by zero".
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 27 Feb 2012 09:04:09 +0000 (18:04 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 27 Feb 2012 09:04:09 +0000 (18:04 +0900)
libarchive/archive_write_add_filter_compress.c

index 84c6db23c37db58c4f22d84c9d9940c8a5ada6e0..4923316f5d8a73e23cb97c29ddd6d8335dd5cdfa 100644 (file)
@@ -396,7 +396,7 @@ archive_compressor_compress_write(struct archive_write_filter *f,
 
                state->checkpoint = state->in_count + CHECK_GAP;
 
-               if (state->in_count <= 0x007fffff)
+               if (state->in_count <= 0x007fffff && state->out_count != 0)
                        ratio = (int)(state->in_count * 256 / state->out_count);
                else if ((ratio = (int)(state->out_count / 256)) == 0)
                        ratio = 0x7fffffff;