]> Kevux Git Server - fll/commitdiff
Bugfix: Perform range check before access array and fix typos in comments.
authorKevin Day <Kevin@kevux.org>
Fri, 15 Nov 2024 03:37:24 +0000 (21:37 -0600)
committerKevin Day <Kevin@kevux.org>
Fri, 15 Nov 2024 03:37:24 +0000 (21:37 -0600)
The range test must be performed and matched before attempting to access the array position at the range.

level_0/f_iki/c/iki.c
level_0/f_iki/c/iki/common.h

index 3654e9ecf8b2453e804cb51ce072d268ddce72b5..c2d42d374167e719b4da22fb71df75008c59726c 100644 (file)
@@ -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;
 
index 891b25a277a735f10a0d1c6f173b39860338715f..e31b42511c19307a1d5b5b4b356b1d9496181b44 100644 (file)
@@ -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.