Skip to content

Commit

Permalink
Fix for recent fuzzer issue
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescAlted committed Feb 18, 2025
1 parent 9b9bca0 commit 9c79bc5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions blosc/blosc2.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,18 @@ int read_chunk_header(const uint8_t* src, int32_t srcsize, bool extended_header,
if (special_type == BLOSC2_SPECIAL_VALUE) {
// In this case, the actual type size must be derived from the cbytes
int32_t typesize = header->cbytes - BLOSC_EXTENDED_HEADER_LENGTH;
if (typesize <= 0) {
BLOSC_TRACE_ERROR("`typesize` is zero or negative");
return BLOSC2_ERROR_INVALID_HEADER;
}
if (typesize > BLOSC2_MAXTYPESIZE) {
BLOSC_TRACE_ERROR("`typesize` is greater than maximum allowed");
return BLOSC2_ERROR_INVALID_HEADER;
}
if (typesize > header->nbytes) {
BLOSC_TRACE_ERROR("`typesize` is greater than `nbytes`");
return BLOSC2_ERROR_INVALID_HEADER;
}
if (header->nbytes % typesize != 0) {
BLOSC_TRACE_ERROR("`nbytes` is not a multiple of typesize");
return BLOSC2_ERROR_INVALID_HEADER;
Expand Down

0 comments on commit 9c79bc5

Please sign in to comment.