Commit 78df0165 authored by Xudong Zhang's avatar Xudong Zhang
Browse files

fix integer overflow

parent 416d394c
......@@ -110,7 +110,7 @@ quicklist *quicklistCreate(void) {
return quicklist;
}
#define COMPRESS_MAX (1 << QL_COMP_BITS)
#define COMPRESS_MAX ((1 << QL_COMP_BITS)-1)
void quicklistSetCompressDepth(quicklist *quicklist, int compress) {
if (compress > COMPRESS_MAX) {
compress = COMPRESS_MAX;
......@@ -120,7 +120,7 @@ void quicklistSetCompressDepth(quicklist *quicklist, int compress) {
quicklist->compress = compress;
}
#define FILL_MAX (1 << (QL_FILL_BITS-1))
#define FILL_MAX ((1 << (QL_FILL_BITS-1))-1)
void quicklistSetFill(quicklist *quicklist, int fill) {
if (fill > FILL_MAX) {
fill = FILL_MAX;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment