Skip to content
Snippets Groups Projects
Commit 5e6d3044 authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

Detect error if cmp_par is NULL

parent 90487e27
Branches
Tags
1 merge request!32Add fuzzing testing setup
......@@ -88,6 +88,8 @@ const char* cmp_get_error_string(enum cmp_error code)
return "Buffer related parameter is not valid";
case CMP_ERROR_PAR_MAX_USED_BITS:
return "Maximum used bits parameters are not valid";
case CMP_ERROR_PAR_NULL:
return "Pointer to the compression parameters structure is NULL.";
case CMP_ERROR_CHUNK_NULL:
return "Pointer to the chunk is NULL. No data, no compression";
......
......@@ -35,6 +35,7 @@ enum cmp_error {
CMP_ERROR_PAR_SPECIFIC = 21,
CMP_ERROR_PAR_BUFFERS = 22,
CMP_ERROR_PAR_MAX_USED_BITS = 23,
CMP_ERROR_PAR_NULL = 24,
/* chunk errors */
CMP_ERROR_CHUNK_NULL = 40,
CMP_ERROR_CHUNK_TOO_LARGE = 41,
......
......@@ -2688,6 +2688,7 @@ uint32_t compress_chunk(void *chunk, uint32_t chunk_size,
size_t read_bytes;
RETURN_ERROR_IF(chunk == NULL, CHUNK_NULL, "");
RETURN_ERROR_IF(cmp_par == NULL, PAR_NULL, "");
RETURN_ERROR_IF(chunk_size < COLLECTION_HDR_SIZE, CHUNK_SIZE_INCONSISTENT,
"chunk_size: %"PRIu32"", chunk_size);
RETURN_ERROR_IF(chunk_size > CMP_ENTITY_MAX_ORIGINAL_SIZE, CHUNK_TOO_LARGE,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment