1
0
mirror of https://github.com/facebook/zstd.git synced 2025-03-07 01:10:04 +02:00

Merge pull request #3033 from facebook/fix44108

fix issue 44108
This commit is contained in:
Yann Collet 2022-01-27 10:57:48 -08:00 committed by GitHub
commit 5d70ec0bc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3440,8 +3440,11 @@ ZSTD_resolveRepcodeToRawOffset(const U32 rep[ZSTD_REP_NUM], const U32 offBase, c
if (adjustedRepCode == ZSTD_REP_NUM) {
/* litlength == 0 and offCode == 2 implies selection of first repcode - 1
* This is only valid if it results in a valid offset value, aka > 0.
* Note : it may happen that `rep[0]==1` in exceptional circumstances.
* In which case this function will return 0, which is an invalid offset.
* It's not an issue though, since this value will be
* compared and discarded within ZSTD_seqStore_resolveOffCodes().
*/
assert(rep[0] > 1);
return rep[0] - 1;
}
return rep[adjustedRepCode];