Skip to content

Commit

Permalink
chores: update LZ4 (EdgeTX#5102)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic authored Jun 2, 2024
1 parent 77feeb6 commit 3bc42e4
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions radio/src/thirdparty/libopenui/thirdparty/lz4/lz4.c
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,17 @@ read_variable_length(const BYTE** ip, const BYTE* ilimit,
if (initial_check && unlikely((*ip) >= ilimit)) { /* read limit reached */
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 {
s = **ip;
(*ip)++;
Expand All @@ -1939,10 +1950,10 @@ read_variable_length(const BYTE** ip, const BYTE* ilimit,
return rvl_error;
}
/* 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;
}
} while (s==255);
} while (s == 255);

return length;
}
Expand Down

0 comments on commit 3bc42e4

Please sign in to comment.