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

TODO: remove stdout print on fuzzing

parent 78e6bbff
No related branches found
No related tags found
No related merge requests found
......@@ -35,6 +35,13 @@
#define CMP_GUESS_MAX_CAL_STEPS 20274
#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
/* Redefine (f)printf to do nothing */
__extension__
#define printf(...) do {} while (0)
#define fprintf(...) do {} while (0)
#endif
/* how often the model is updated before it is rested */
static int num_model_updates = CMP_GUESS_N_MODEL_UPDATE_DEF;
......
......@@ -292,9 +292,11 @@ int write_data_to_file(const void *buf, uint32_t buf_size, const char *output_pr
}
if (flags & CMP_IO_VERBOSE_EXTRA && !(flags & CMP_IO_BINARY)) {
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
printf("\n");
fwrite(output_file_data, 1, output_file_size, stdout);
printf("\n");
#endif
}
free(tmp_buf);
......@@ -499,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];
......
......@@ -153,6 +153,7 @@ static uint32_t model_counter;
__extension__
#define printf(...) do {} while (0)
#define fprintf(...) do {} while (0)
#define fflush(...) do {} while (0)
int CMP_MAIN(int argc, char **argv);
......@@ -649,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
......@@ -658,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.
Finish editing this message first!
Please register or to comment