From: Kevin Day Date: Fri, 15 Nov 2024 03:37:24 +0000 (-0600) Subject: Bugfix: Perform range check before access array and fix typos in comments. X-Git-Tag: 0.6.13~36 X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=c3b3983c46d51656343cb03ff99ade3508c37480;p=fll Bugfix: Perform range check before access array and fix typos in comments. The range test must be performed and matched before attempting to access the array position at the range. --- diff --git a/level_0/f_iki/c/iki.c b/level_0/f_iki/c/iki.c index 3654e9e..c2d42d3 100644 --- a/level_0/f_iki/c/iki.c +++ b/level_0/f_iki/c/iki.c @@ -98,7 +98,7 @@ extern "C" { const f_array_length_t delimits_used = data->delimits.used; uint8_t quote = 0; - uint8_t wrapped = F_false; // 0x0 (false) = not wapped, 0x1 (true) = wrapped, 0x2 = valid wrapped. + uint8_t wrapped = F_false; // 0x0 (false) = not wrapped, 0x1 (true) = wrapped, 0x2 = valid wrapped. do { @@ -180,7 +180,7 @@ extern "C" { if (buffer->string[range->start] == f_iki_syntax_separator_s.string[0]) { - // Wrapped must close in a wrap close before the seperator. + // Wrapped must close in a wrap close before the separator. if (wrapped == F_true) { status = F_next; @@ -189,7 +189,7 @@ extern "C" { do { status = f_utf_buffer_increment(*buffer, range, 1); - } while (F_status_is_fine(status) && buffer->string[range->start] == f_iki_syntax_placeholder_s.string[0] && range->start <= range->stop && range->start < buffer->used); + } while (F_status_is_error_not(status) && range->start <= range->stop && range->start < buffer->used && buffer->string[range->start] == f_iki_syntax_placeholder_s.string[0]); if (F_status_is_error(status) || range->start > range->stop || range->start >= buffer->used) break; diff --git a/level_0/f_iki/c/iki/common.h b/level_0/f_iki/c/iki/common.h index 891b25a..e31b425 100644 --- a/level_0/f_iki/c/iki/common.h +++ b/level_0/f_iki/c/iki/common.h @@ -333,7 +333,7 @@ extern "C" { #endif // _di_f_iki_contents_t_ /** - * This containg all of the IKI data. + * This containing all of the IKI data. * * content: A set of ranges representing the content list to store the content associated with the found vocabulary name. * delimits: A delimits array representing where delimits exist within the buffer.