]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
fix un-initialized memory warning 921/head
authorYann Collet <cyan@fb.com>
Fri, 17 Nov 2017 23:51:52 +0000 (15:51 -0800)
committerYann Collet <cyan@fb.com>
Fri, 17 Nov 2017 23:51:52 +0000 (15:51 -0800)
harmless, but cleaner

lib/compress/zstd_opt.c

index aebe55f882bb42028d72f26174a8d568fb916529..04f03ebcd4e14958237a6d5e016fa92b1c34edbd 100644 (file)
@@ -588,9 +588,8 @@ size_t ZSTD_compressBlock_opt_generic(ZSTD_CCtx* ctx,
                     while (mlen <= lastML) {
                         U32 const pos = cur + mlen;
                         U32 const price = basePrice + ZSTD_getPrice(optStatePtr, litlen, baseLiterals, offset, mlen, ultra);
-                        assert(pos < ZSTD_OPT_NUM);
 
-                        if ((pos > last_pos) | (price < opt[pos].price)) {
+                        if ((pos > last_pos) || (price < opt[pos].price)) {
                             DEBUGLOG(7, "rPos:%u => new better price (%u<%u)",
                                         pos, price, opt[pos].price);
                             SET_PRICE(pos, mlen, offset, litlen, price, repHistory);  /* note : macro modifies last_pos */