diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2015-07-05 13:51:50 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2015-07-05 13:51:50 -0700 |
commit | 8a979f6c7986574e37316148cd8ca440c3bc08a3 (patch) | |
tree | 3ea2a8d06aada40f9e9d71c5b0d2001a290451f1 | |
parent | 9859a94c1002484ee5f824c05683a5b2484cbf49 (diff) | |
download | zlib-8a979f6c7986574e37316148cd8ca440c3bc08a3.tar.gz zlib-8a979f6c7986574e37316148cd8ca440c3bc08a3.tar.bz2 zlib-8a979f6c7986574e37316148cd8ca440c3bc08a3.zip |
Avoid left shift of a negative value in flush rank calculation.
The C standard permits an undefined result for a left shift of a
negative value.
-rw-r--r-- | deflate.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -156,7 +156,7 @@ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ | |||
156 | #endif | 156 | #endif |
157 | 157 | ||
158 | /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ | 158 | /* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ |
159 | #define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) | 159 | #define RANK(f) (((f) * 2) - ((f) > 4 ? 9 : 0)) |
160 | 160 | ||
161 | /* =========================================================================== | 161 | /* =========================================================================== |
162 | * Update a hash value with the given input byte | 162 | * Update a hash value with the given input byte |