diff options
-rw-r--r-- | Utilities/cmzlib/gzread.c | 6 | ||||
-rw-r--r-- | Utilities/cmzlib/gzwrite.c | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/Utilities/cmzlib/gzread.c b/Utilities/cmzlib/gzread.c index 22052dd..e3519e6 100644 --- a/Utilities/cmzlib/gzread.c +++ b/Utilities/cmzlib/gzread.c @@ -434,6 +434,12 @@ z_size_t ZEXPORT gzfread(buf, size, nitems, file) return 0; } +#ifdef __clang_analyzer__ + /* clang-analyzer does not see size==0 through len==0 below. */ + if (!size) + return 0; +#endif + /* read len or fewer bytes to buf, return the number of full items read */ return len ? gz_read(state, buf, len) / size : 0; } diff --git a/Utilities/cmzlib/gzwrite.c b/Utilities/cmzlib/gzwrite.c index a8ffc8f..33f4949 100644 --- a/Utilities/cmzlib/gzwrite.c +++ b/Utilities/cmzlib/gzwrite.c @@ -305,6 +305,12 @@ z_size_t ZEXPORT gzfwrite(buf, size, nitems, file) return 0; } +#ifdef __clang_analyzer__ + /* clang-analyzer does not see size==0 through len==0 below. */ + if (!size) + return 0; +#endif + /* write len bytes to buf, return the number of full items written */ return len ? gz_write(state, buf, len) / size : 0; } |