add several fixme and todo comments regarding invoking destructors

Wed, 03 Sep 2025 22:59:09 +0200

author
Mike Becker <universe@uap-core.de>
date
Wed, 03 Sep 2025 22:59:09 +0200
changeset 1362
d886626a9526
parent 1361
cdc3242a9b33
child 1363
c9a86bd9e361

add several fixme and todo comments regarding invoking destructors

relates to #461

src/kv_list.c file | annotate | diff | comparison | revisions
--- a/src/kv_list.c	Wed Sep 03 22:52:20 2025 +0200
+++ b/src/kv_list.c	Wed Sep 03 22:59:09 2025 +0200
@@ -98,7 +98,7 @@
         const void *elem,
         int prepend
 ) {
-    cx_kv_list *kv_list = (cx_kv_list*)iter->src_handle.m;
+    cx_kv_list *kv_list = iter->src_handle.m;
     // TODO: trick the base method by adding the required space for the key to the elem_size
     return kv_list->list_methods->insert_iter(iter, elem, prepend);
 }
@@ -113,11 +113,15 @@
     // TODO: always use the target buffer to get the element first,
     //       then obtain the key, remove it from the map,
     //       and finally call any destructors manually
+    // TODO: map destructors are not called
     return kv_list->list_methods->remove(list, index, num, targetbuf);
 }
 
 static void cx_kvl_clear(struct cx_list_s *list) {
     cx_kv_list *kv_list = (cx_kv_list*)list;
+    // FIXME: this is probably totally bugged, because
+    //        a) the map may have destructors which are invoked triggering UAF
+    //        b) the destructors registered with the map are not called for all list elements
     kv_list->list_methods->clear(list);
     // also clear all lookup entries
     cxMapClear(&kv_list->map->map_base.base);
@@ -146,7 +150,7 @@
         bool remove
 ) {
     cx_kv_list *kv_list = (cx_kv_list*)list;
-    // TODO: implement removal of the key in the map
+    // TODO: implement removal of the key in the map and calling the map destructors
     return kv_list->list_methods->find_remove(list, elem, remove);
 }
 

mercurial