From 5bef3f18d8f1977b4855cec224837988e2caf112 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Tue, 2 Aug 2022 19:13:15 -0500 Subject: [PATCH] Bugfix: Content is incorrectly attempted to be processed even though it does not exist. There is happening due to a missing check to see if the Content array is empty. --- level_3/fake/c/private-make-load_fakefile.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/level_3/fake/c/private-make-load_fakefile.c b/level_3/fake/c/private-make-load_fakefile.c index 7aa7b3d..26e3372 100644 --- a/level_3/fake/c/private-make-load_fakefile.c +++ b/level_3/fake/c/private-make-load_fakefile.c @@ -172,28 +172,30 @@ extern "C" { data_make->id_main = data_make->fakefile.used; } - data_make->fakefile.array[data_make->fakefile.used].name = list_objects.array[i]; - delimits.used = 0; - content_range = list_contents.array[i].array[0]; + data_make->fakefile.array[data_make->fakefile.used].name = list_objects.array[i]; data_make->fakefile.array[data_make->fakefile.used].objects.used = 0; data_make->fakefile.array[data_make->fakefile.used].contents.used = 0; data_make->fakefile.array[data_make->fakefile.used].quotess.used = 0; - *status = fll_fss_extended_read(data_make->buffer, state, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &delimits, 0); + if (list_contents.array[i].used) { + content_range = list_contents.array[i].array[0]; - if (F_status_is_error(*status)) { - fake_print_error_fss(data_make->data, F_status_set_fine(*status), "fll_fss_extended_read", data_make->data->file_data_build_fakefile, content_range, F_true); + *status = fll_fss_extended_read(data_make->buffer, state, &content_range, &data_make->fakefile.array[data_make->fakefile.used].objects, &data_make->fakefile.array[data_make->fakefile.used].contents, 0, &data_make->fakefile.array[data_make->fakefile.used].quotess, &delimits, 0); - break; - } + if (F_status_is_error(*status)) { + fake_print_error_fss(data_make->data, F_status_set_fine(*status), "fll_fss_extended_read", data_make->data->file_data_build_fakefile, content_range, F_true); - *status = f_fss_apply_delimit(state, delimits, &data_make->buffer); + break; + } - if (F_status_is_error(*status)) { - fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true); + *status = f_fss_apply_delimit(state, delimits, &data_make->buffer); - break; + if (F_status_is_error(*status)) { + fll_error_print(data_make->main->error, F_status_set_fine(*status), "f_fss_apply_delimit", F_true); + + break; + } } ++data_make->fakefile.used; -- 1.8.3.1