Skip to content
Snippets Groups Projects
Commit 82efb641 authored by Deucе's avatar Deucе :ok_hand_tone4:
Browse files

Suppress Coverity assertion.

Coverity believes that after checking that c < LZH_ROOT (636), it's
possible for (c + 1) to be greater than 65535.
parent c045c2d6
No related branches found
No related tags found
No related merge requests found
Pipeline #7633 passed
...@@ -430,7 +430,7 @@ static bool lzh_update(huffman_t* huff, uint16_t c) ...@@ -430,7 +430,7 @@ static bool lzh_update(huffman_t* huff, uint16_t c)
/* /*
* This is not actually possible. * This is not actually possible.
*/ */
if (c >= LZH_TABLE_SZ) if (c > LZH_ROOT)
return false; return false;
tmp = ++huff->freq[c]; tmp = ++huff->freq[c];
   
...@@ -455,8 +455,14 @@ static bool lzh_update(huffman_t* huff, uint16_t c) ...@@ -455,8 +455,14 @@ static bool lzh_update(huffman_t* huff, uint16_t c)
* we don't actually need the second test here) * we don't actually need the second test here)
* *
* We can do the range check second because * We can do the range check second because
* huff->freq[LZH_TABLE_SZ] is valid * huff->freq[LZH_ROOT+1] is valid
*/ */
/*
* Coverity thinks that c+1 can overflow despite
* the c < LZH_ROOT test above. Tell it it's
* wrong.
*/
// coverity[cast_overflow:SUPPRESS]
for (l = c + 1; tmp > huff->freq[l + 1] && l < LZH_ROOT; l++) for (l = c + 1; tmp > huff->freq[l + 1] && l < LZH_ROOT; l++)
; ;
   
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment