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

Fix: Add null checks for guess_option

- Added null checks to case_insensitive_compare in cmp_io.c
parent 44026628
No related branches found
No related tags found
1 merge request!36Ensured error handling is now consistent with the --binary
......@@ -501,6 +501,12 @@ int case_insensitive_compare(const char *s1, const char *s2)
{
size_t i;
if(s1 == NULL)
abort();
if(s2 == NULL)
abort();
for (i = 0; ; ++i) {
unsigned int x1 = (unsigned char)s1[i];
unsigned int x2 = (unsigned char)s2[i];
......
......@@ -650,7 +650,7 @@ static int guess_cmp_pars(struct rdcu_cfg *rcfg, struct cmp_par *chunk_par,
printf("Search for a good set of compression parameters (level: %d) ... ", guess_level);
fflush(stdout);
if (!case_insensitive_compare(guess_option, "rdcu")) {
if (guess_option && !case_insensitive_compare(guess_option, "rdcu")) {
if (add_rdcu_pars)
data_type = DATA_TYPE_IMAGETTE_ADAPTIVE;
else
......@@ -659,7 +659,7 @@ static int guess_cmp_pars(struct rdcu_cfg *rcfg, struct cmp_par *chunk_par,
rcfg->cmp_mode = CMP_GUESS_DEF_MODE_MODEL;
else
rcfg->cmp_mode = CMP_GUESS_DEF_MODE_DIFF;
} else if (!case_insensitive_compare(guess_option, "chunk")) {
} else if (guess_option && !case_insensitive_compare(guess_option, "chunk")) {
data_type = DATA_TYPE_CHUNK;
} else {
data_type = DATA_TYPE_IMAGETTE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment