chores: update LZ4 (#5102)

This commit is contained in:
Raphael Coeffic
2024-06-02 19:53:51 +10:00
committed by GitHub
parent 77feeb62f7
commit 3bc42e4538
+13 -2
View File
@@ -1931,6 +1931,17 @@ read_variable_length(const BYTE** ip, const BYTE* ilimit,
if (initial_check && unlikely((*ip) >= ilimit)) { /* read limit reached */ if (initial_check && unlikely((*ip) >= ilimit)) { /* read limit reached */
return rvl_error; return rvl_error;
} }
s = **ip;
(*ip)++;
length += s;
if (unlikely((*ip) > ilimit)) { /* read limit reached */
return rvl_error;
}
/* accumulator overflow detection (32-bit mode only) */
if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
return rvl_error;
}
if (likely(s != 255)) return length;
do { do {
s = **ip; s = **ip;
(*ip)++; (*ip)++;
@@ -1939,10 +1950,10 @@ read_variable_length(const BYTE** ip, const BYTE* ilimit,
return rvl_error; return rvl_error;
} }
/* accumulator overflow detection (32-bit mode only) */ /* accumulator overflow detection (32-bit mode only) */
if ((sizeof(length)<8) && unlikely(length > ((Rvl_t)(-1)/2)) ) { if ((sizeof(length) < 8) && unlikely(length > ((Rvl_t)(-1)/2)) ) {
return rvl_error; return rvl_error;
} }
} while (s==255); } while (s == 255);
return length; return length;
} }