Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cmp_tool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dominik Loidolt
cmp_tool
Commits
6f405478
Commit
6f405478
authored
1 year ago
by
Dominik Loidolt
Browse files
Options
Downloads
Patches
Plain Diff
Add new error code if the max_used_bits parameters are invalid
parent
9dc35e6d
No related branches found
No related tags found
1 merge request
!30
Enhanced Error Handling in Chunk Compression Functions
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/common/cmp_error.c
+2
-0
2 additions, 0 deletions
lib/common/cmp_error.c
lib/common/cmp_error_list.h
+1
-0
1 addition, 0 deletions
lib/common/cmp_error_list.h
lib/icu_compress/cmp_icu.c
+2
-2
2 additions, 2 deletions
lib/icu_compress/cmp_icu.c
with
5 additions
and
2 deletions
lib/common/cmp_error.c
+
2
−
0
View file @
6f405478
...
@@ -86,6 +86,8 @@ const char* cmp_get_error_string(enum cmp_error code)
...
@@ -86,6 +86,8 @@ const char* cmp_get_error_string(enum cmp_error code)
return
"Specific compression parameters or combination is unsupported"
;
return
"Specific compression parameters or combination is unsupported"
;
case
CMP_ERROR_PAR_BUFFERS
:
case
CMP_ERROR_PAR_BUFFERS
:
return
"Buffer related parameter is not valid"
;
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_CHUNK_NULL
:
case
CMP_ERROR_CHUNK_NULL
:
return
"Pointer to the chunk is NULL. No data, no compression"
;
return
"Pointer to the chunk is NULL. No data, no compression"
;
...
...
This diff is collapsed.
Click to expand it.
lib/common/cmp_error_list.h
+
1
−
0
View file @
6f405478
...
@@ -34,6 +34,7 @@ enum cmp_error {
...
@@ -34,6 +34,7 @@ enum cmp_error {
CMP_ERROR_PAR_GENERIC
=
20
,
CMP_ERROR_PAR_GENERIC
=
20
,
CMP_ERROR_PAR_SPECIFIC
=
21
,
CMP_ERROR_PAR_SPECIFIC
=
21
,
CMP_ERROR_PAR_BUFFERS
=
22
,
CMP_ERROR_PAR_BUFFERS
=
22
,
CMP_ERROR_PAR_MAX_USED_BITS
=
23
,
/* chunk errors */
/* chunk errors */
CMP_ERROR_CHUNK_NULL
=
40
,
CMP_ERROR_CHUNK_NULL
=
40
,
CMP_ERROR_CHUNK_TOO_LARGE
=
41
,
CMP_ERROR_CHUNK_TOO_LARGE
=
41
,
...
...
This diff is collapsed.
Click to expand it.
lib/icu_compress/cmp_icu.c
+
2
−
2
View file @
6f405478
...
@@ -2031,7 +2031,7 @@ static uint32_t cmp_cfg_icu_is_invalid_error_code(const struct cmp_cfg *cfg)
...
@@ -2031,7 +2031,7 @@ static uint32_t cmp_cfg_icu_is_invalid_error_code(const struct cmp_cfg *cfg)
RETURN_ERROR_IF
(
cmp_cfg_icu_buffers_is_invalid
(
cfg
),
PAR_BUFFERS
,
""
);
RETURN_ERROR_IF
(
cmp_cfg_icu_buffers_is_invalid
(
cfg
),
PAR_BUFFERS
,
""
);
if
(
cfg
->
cmp_mode
!=
CMP_MODE_RAW
)
if
(
cfg
->
cmp_mode
!=
CMP_MODE_RAW
)
RETURN_ERROR_IF
(
cmp_cfg_icu_max_used_bits_out_of_limit
(
cfg
->
max_used_bits
),
GENERIC
,
""
);
RETURN_ERROR_IF
(
cmp_cfg_icu_max_used_bits_out_of_limit
(
cfg
->
max_used_bits
),
PAR_MAX_USED_BITS
,
""
);
if
(
cmp_imagette_data_type_is_used
(
cfg
->
data_type
))
{
if
(
cmp_imagette_data_type_is_used
(
cfg
->
data_type
))
{
RETURN_ERROR_IF
(
cmp_cfg_imagette_is_invalid
(
cfg
,
ICU_CHECK
),
PAR_SPECIFIC
,
""
);
RETURN_ERROR_IF
(
cmp_cfg_imagette_is_invalid
(
cfg
,
ICU_CHECK
),
PAR_SPECIFIC
,
""
);
...
@@ -2777,7 +2777,7 @@ uint32_t compress_chunk_cmp_size_bound(const void *chunk, size_t chunk_size)
...
@@ -2777,7 +2777,7 @@ uint32_t compress_chunk_cmp_size_bound(const void *chunk, size_t chunk_size)
/* count the number of collections in the chunk */
/* count the number of collections in the chunk */
for
(
read_bytes
=
0
;
for
(
read_bytes
=
0
;
read_bytes
<=
(
int32_t
)
chunk_size
-
COLLECTION_HDR_SIZE
;
read_bytes
<=
(
int32_t
)
(
chunk_size
-
COLLECTION_HDR_SIZE
)
;
read_bytes
+=
cmp_col_get_size
((
const
struct
collection_hdr
*
)((
const
uint8_t
*
)
chunk
+
read_bytes
)))
read_bytes
+=
cmp_col_get_size
((
const
struct
collection_hdr
*
)((
const
uint8_t
*
)
chunk
+
read_bytes
)))
num_col
++
;
num_col
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment