Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package libcdada for openSUSE:Factory checked in at 2026-06-29 17:31:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libcdada (Old) and /work/SRC/openSUSE:Factory/.libcdada.new.11887 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libcdada" Mon Jun 29 17:31:00 2026 rev:8 rq:1362297 version:0.6.4 Changes: -------- --- /work/SRC/openSUSE:Factory/libcdada/libcdada.changes 2026-01-29 18:59:36.174048747 +0100 +++ /work/SRC/openSUSE:Factory/.libcdada.new.11887/libcdada.changes 2026-06-29 17:32:12.677822715 +0200 @@ -1,0 +2,34 @@ +Mon Jun 29 05:27:27 UTC 2026 - Dirk Müller <[email protected]> + +- update to 0.6.4: + * [B] utils: fix `cdada_strerr()` bounds handling for invalid + and negative error codes + * [B] utils: add missing human-readable message for + `CDADA_E_FULL` + * [B] list/map/queue/set/stack: return `NULL` when constructor + `malloc()` fails (avoid null dereference) + * [B] str: fix `cdada_str_replace*()` to reject empty match and + self-replacement issues + * [B] str: return `NULL` in `cdada_str_create()` when input C + string is `NULL` + * [B] str: align `cdada_str()` invalid-handle behavior with API + docs (return `NULL`, not empty string) + * [B] bbitmap: make `cdada_bbitmap_dump()` set `size_used` in + buffered paths too + * [B] bbitmap: fix corrupted BSD license header in `bbitmap.h` + * [B] str: fix underflow in `cdada_str_rtraverse()` on empty + strings + * [B] list: fix `cdada_list_first()`/`cdada_list_last()` + returning `CDADA_SUCCESS` on invalid input + * [B] set: fix `cdada_set_find()` returning `true` on internal + error + * [B] str: fix uint32_t overflow in `cdada_str_erase()` bounds + check + * [B] str: fix `cdada_str_find_count()`/`cdada_str_find_all()` + not returning `CDADA_E_NOT_FOUND` + * [B] str: reject empty `substr` in + `cdada_str_find_count()`/`cdada_str_find_all()` + * [B] list/map/queue/set/stack: report `size_used` as bytes + written on incomplete `dump()` + +------------------------------------------------------------------- Old: ---- libcdada-0.6.3.tar.gz New: ---- libcdada-0.6.4.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libcdada.spec ++++++ --- /var/tmp/diff_new_pack.CyRdhW/_old 2026-06-29 17:32:14.469883896 +0200 +++ /var/tmp/diff_new_pack.CyRdhW/_new 2026-06-29 17:32:14.481884306 +0200 @@ -1,7 +1,7 @@ # # spec file for package libcdada # -# Copyright (c) 2025 SUSE LLC and contributors +# Copyright (c) 2026 SUSE LLC and contributors # Copyright (c) 2021, Martin Hauke <[email protected]> # Copyright (c) 2026 Andreas Stieger <[email protected]> # @@ -20,7 +20,7 @@ %define sover 0 Name: libcdada -Version: 0.6.3 +Version: 0.6.4 Release: 0 Summary: Basic data structures in C (libstdc++ wrapper) License: BSD-2-Clause ++++++ libcdada-0.6.3.tar.gz -> libcdada-0.6.4.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/.github/workflows/test_script.sh new/libcdada-0.6.4/.github/workflows/test_script.sh --- old/libcdada-0.6.3/.github/workflows/test_script.sh 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/.github/workflows/test_script.sh 2026-02-27 23:40:10.000000000 +0100 @@ -20,6 +20,8 @@ cd build ../configure $CONFIG_FLAGS || (cat config.log && /bin/false) make check || ((for f in `find test/ -name "*.log"`; do cat $f; done;) && /bin/false) +echo "Running oom_create_test without valgrind..." +./test/oom_create_test echo "Running examples..." valgrind --leak-check=full examples/bbitmap diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/CHANGELOG.md new/libcdada-0.6.4/CHANGELOG.md --- old/libcdada-0.6.3/CHANGELOG.md 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/CHANGELOG.md 2026-02-27 23:40:10.000000000 +0100 @@ -9,6 +9,30 @@ - [O] Other ``` +### v0.6.4 (27th February 2026) + +- [B] utils: fix `cdada_strerr()` bounds handling for invalid and negative error codes +- [B] utils: add missing human-readable message for `CDADA_E_FULL` +- [B] list/map/queue/set/stack: return `NULL` when constructor `malloc()` fails (avoid null dereference) +- [B] str: fix `cdada_str_replace*()` to reject empty match and self-replacement issues +- [B] str: return `NULL` in `cdada_str_create()` when input C string is `NULL` +- [B] str: align `cdada_str()` invalid-handle behavior with API docs (return `NULL`, not empty string) +- [B] bbitmap: make `cdada_bbitmap_dump()` set `size_used` in buffered paths too +- [B] bbitmap: fix corrupted BSD license header in `bbitmap.h` +- [B] str: fix underflow in `cdada_str_rtraverse()` on empty strings +- [B] list: fix `cdada_list_first()`/`cdada_list_last()` returning `CDADA_SUCCESS` on invalid input +- [B] set: fix `cdada_set_find()` returning `true` on internal error +- [B] str: fix uint32_t overflow in `cdada_str_erase()` bounds check +- [B] str: fix `cdada_str_find_count()`/`cdada_str_find_all()` not returning `CDADA_E_NOT_FOUND` +- [B] str: reject empty `substr` in `cdada_str_find_count()`/`cdada_str_find_all()` +- [B] list/map/queue/set/stack: report `size_used` as bytes written on incomplete `dump()` +- [O] tests: add coverage for `cdada_strerr()` valid, boundary and high invalid values +- [O] tests: add `oom_create_test` coverage for create paths (`list`, `map`, `queue`, `set`, `stack`, `str`, `bbitmap`) +- [O] tests: add coverage for `cdada_str_replace_all()` empty-match invalid input and self-overlap replacement +- [O] tests: add `cdada_str_create(NULL)` regression coverage +- [O] tests: align invalid `cdada_str()` assertion with documented `NULL` return +- [O] tests: validate `cdada_bbitmap_dump()` updates `size_used` for both incomplete and complete buffered dumps + ### v0.6.3 (28th January 2026) - [O] tests/CI: fixed compilation with GCC 16 (thanks A. Stieger). Added CI coverage for GCC 15. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/VERSION new/libcdada-0.6.4/VERSION --- old/libcdada-0.6.3/VERSION 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/VERSION 2026-02-27 23:40:10.000000000 +0100 @@ -1 +1 @@ -v0.6.3 +v0.6.4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/include/cdada/bbitmap.h new/libcdada-0.6.4/include/cdada/bbitmap.h --- old/libcdada-0.6.3/include/cdada/bbitmap.h 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/include/cdada/bbitmap.h 2026-02-27 23:40:10.000000000 +0100 @@ -2,15 +2,15 @@ Copyright (c) 2020, Marc Sune Clos All rights reserved. -Redibbitmapibution and use in source and binary forms, with or without +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redibbitmapibutions of source code must retain the above copyright notice, this +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. -* Redibbitmapibutions in binary form must reproduce the above copyright notice, +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the dibbitmapibution. + and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/bbitmap.cc new/libcdada-0.6.4/src/bbitmap.cc --- old/libcdada-0.6.3/src/bbitmap.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/bbitmap.cc 2026-02-27 23:40:10.000000000 +0100 @@ -112,15 +112,16 @@ std::stringstream ss; for(i=0;i<b->n_words; ++i) __cdada_bbitmap_dump_word(i, &b->ptr[i], ss); + *size_used = ss.str().length()+1; - if(!buffer){ - *size_used = ss.str().length()+1; + if(!buffer) return CDADA_SUCCESS; - } snprintf(buffer, size, "%s", ss.str().c_str()); - if(ss.str().length()+1 > size) + if(*size_used > size){ + *size_used = size; return CDADA_E_INCOMPLETE; + } }catch(bad_alloc& e){ return CDADA_E_MEM; }catch(...){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/list.cc new/libcdada-0.6.4/src/list.cc --- old/libcdada-0.6.3/src/list.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/list.cc 2026-02-27 23:40:10.000000000 +0100 @@ -16,6 +16,8 @@ return m; m = (__cdada_list_int_t*)malloc(sizeof(__cdada_list_int_t)); + if(!m) + return NULL; memset(m, 0, sizeof(__cdada_list_int_t)); m->magic_num = CDADA_MAGIC; m->user_val_len = val_size; @@ -401,7 +403,7 @@ __cdada_list_int_t* m = (__cdada_list_int_t*)list; if(unlikely(!m || m->magic_num != CDADA_MAGIC || !key)) - return false; + return CDADA_E_INVALID; try{ int c = m->ops? 0 : m->val_len; @@ -450,7 +452,7 @@ }catch(...){} CDADA_ASSERT(0); - return false; + return CDADA_E_UNKNOWN; } int cdada_list_first(const cdada_list_t* list, void* key){ @@ -1104,8 +1106,10 @@ return CDADA_SUCCESS; snprintf(buffer, size, "%s", ss.str().c_str()); - if(ss.str().length()+1 > size) + if(*size_used > size){ + *size_used = size; return CDADA_E_INCOMPLETE; + } }catch(bad_alloc& e){ return CDADA_E_MEM; }catch(...){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/map.cc new/libcdada-0.6.4/src/map.cc --- old/libcdada-0.6.3/src/map.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/map.cc 2026-02-27 23:40:10.000000000 +0100 @@ -16,6 +16,8 @@ return m; m = (__cdada_map_int_t*)malloc(sizeof(__cdada_map_int_t)); + if(!m) + return NULL; memset(m, 0, sizeof(__cdada_map_int_t)); m->magic_num = CDADA_MAGIC; m->user_key_len = key_size; @@ -899,8 +901,10 @@ return CDADA_SUCCESS; snprintf(buffer, size, "%s", ss.str().c_str()); - if(ss.str().length()+1 > size) + if(*size_used > size){ + *size_used = size; return CDADA_E_INCOMPLETE; + } }catch(bad_alloc& e){ return CDADA_E_MEM; }catch(...){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/queue.cc new/libcdada-0.6.4/src/queue.cc --- old/libcdada-0.6.3/src/queue.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/queue.cc 2026-02-27 23:40:10.000000000 +0100 @@ -16,6 +16,8 @@ return m; m = (__cdada_queue_int_t*)malloc(sizeof(__cdada_queue_int_t)); + if(!m) + return NULL; memset(m, 0, sizeof(__cdada_queue_int_t)); m->magic_num = CDADA_MAGIC; m->user_val_len = val_size; @@ -555,8 +557,10 @@ return CDADA_SUCCESS; snprintf(buffer, size, "%s", ss.str().c_str()); - if(ss.str().length()+1 > size) + if(*size_used > size){ + *size_used = size; return CDADA_E_INCOMPLETE; + } }catch(bad_alloc& e){ return CDADA_E_MEM; }catch(...){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/set.cc new/libcdada-0.6.4/src/set.cc --- old/libcdada-0.6.3/src/set.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/set.cc 2026-02-27 23:40:10.000000000 +0100 @@ -16,6 +16,8 @@ return m; m = (__cdada_set_int_t*)malloc(sizeof(__cdada_set_int_t)); + if(!m) + return NULL; memset(m, 0, sizeof(__cdada_set_int_t)); m->magic_num = CDADA_MAGIC; m->user_key_len = key_size; @@ -446,7 +448,7 @@ return (*m->ops->find)(m, key); default: CDADA_ASSERT(0); - return CDADA_E_UNKNOWN; + return false; } }catch(...){} @@ -818,8 +820,10 @@ return CDADA_SUCCESS; snprintf(buffer, size, "%s", ss.str().c_str()); - if(ss.str().length()+1 > size) + if(*size_used > size){ + *size_used = size; return CDADA_E_INCOMPLETE; + } }catch(bad_alloc& e){ return CDADA_E_MEM; }catch(...){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/stack.cc new/libcdada-0.6.4/src/stack.cc --- old/libcdada-0.6.3/src/stack.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/stack.cc 2026-02-27 23:40:10.000000000 +0100 @@ -16,6 +16,8 @@ return m; m = (__cdada_stack_int_t*)malloc(sizeof(__cdada_stack_int_t)); + if(!m) + return NULL; memset(m, 0, sizeof(__cdada_stack_int_t)); m->magic_num = CDADA_MAGIC; m->user_val_len = val_size; @@ -493,8 +495,10 @@ return CDADA_SUCCESS; snprintf(buffer, size, "%s", ss.str().c_str()); - if(ss.str().length()+1 > size) + if(*size_used > size){ + *size_used = size; return CDADA_E_INCOMPLETE; + } }catch(bad_alloc& e){ return CDADA_E_MEM; }catch(...){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/str.cc new/libcdada-0.6.4/src/str.cc --- old/libcdada-0.6.3/src/str.cc 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/str.cc 2026-02-27 23:40:10.000000000 +0100 @@ -12,6 +12,9 @@ __cdada_str_int_t* m = NULL; + if(!str) + return NULL; + m = (__cdada_str_int_t*)malloc(sizeof(__cdada_str_int_t)); if(!m) return NULL; @@ -90,6 +93,8 @@ try{ std::string::const_reverse_iterator it; + if(s.empty()) + return CDADA_SUCCESS; uint32_t pos = s.length()-1; for(it = s.rbegin(); it != s.rend(); ++it){ (*func)(str, *it, pos, opaque); @@ -140,7 +145,7 @@ __cdada_str_int_t* m = (__cdada_str_int_t*)str; if(!m || m->magic_num != CDADA_MAGIC) - return ""; + return NULL; try{ return m->str->c_str(); @@ -148,7 +153,7 @@ CDADA_ASSERT(0); } - return ""; + return NULL; } int __cdada_str_find(const cdada_str_t* str, const char* substr, uint32_t* pos, @@ -201,7 +206,7 @@ CDADA_CHECK_MAGIC(m); - if(!substr || !n) + if(!substr || !n || !*substr) return CDADA_E_INVALID; std::string& s = *m->str; @@ -227,7 +232,7 @@ return CDADA_E_UNKNOWN; } - return CDADA_SUCCESS; + return (*n == 0)? CDADA_E_NOT_FOUND : CDADA_SUCCESS; } int cdada_str_find_all(const cdada_str_t* str, const char* substr, @@ -238,7 +243,7 @@ CDADA_CHECK_MAGIC(m); - if(!substr || !poss || !size || !cnt) + if(!substr || !poss || !size || !cnt || !*substr) return CDADA_E_INVALID; std::string& s = *m->str; @@ -263,7 +268,7 @@ return CDADA_E_UNKNOWN; } - return CDADA_SUCCESS; + return (*cnt == 0)? CDADA_E_NOT_FOUND : CDADA_SUCCESS; } int cdada_str_first_c(const cdada_str_t* str, char* c){ @@ -480,7 +485,7 @@ std::string& s = *m->str; - if(pos > s.length() || (pos+substr_len) > s.length() ) + if(pos > s.length() || ((size_t)pos+substr_len) > s.length()) return CDADA_E_INVALID; try{ @@ -538,15 +543,20 @@ if(!match || !new_str) return CDADA_E_INVALID; + size_t l = strlen(match); + size_t new_l = strlen(new_str); + size_t pos = 0; + + if(!l) + return CDADA_E_INVALID; + std::string& s = *m->str; try{ - size_t pos = s.find(match); - size_t l = strlen(match); - + pos = s.find(match, pos); while(pos != string::npos){ s.replace(pos, l, new_str); - pos += l; + pos += new_l; pos = s.find(match, pos); } }catch(bad_alloc& e){ @@ -569,9 +579,13 @@ if(!match || !new_str) return CDADA_E_INVALID; - std::string& s = *m->str; size_t l = strlen(match); + if(!l) + return CDADA_E_INVALID; + + std::string& s = *m->str; + if(pos+l > s.length()) return CDADA_E_INVALID; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/src/utils.c new/libcdada-0.6.4/src/utils.c --- old/libcdada-0.6.3/src/utils.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/src/utils.c 2026-02-27 23:40:10.000000000 +0100 @@ -10,11 +10,12 @@ "Out of memory", "Feature unsupported", "Empty", - "Incomplete" + "Incomplete", + "Full" }; const char* cdada_strerr(int err){ - return err >= CDADA_E_COUNT? "Invalid code" : cdada_err_str[err]; + return (err < 0 || err >= CDADA_E_COUNT)? "Invalid code" : cdada_err_str[err]; } const char* cdada_get_ver(){ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/Makefile.am new/libcdada-0.6.4/test/Makefile.am --- old/libcdada-0.6.3/test/Makefile.am 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/Makefile.am 2026-02-27 23:40:10.000000000 +0100 @@ -8,6 +8,7 @@ cdada_include_test \ list_test \ map_test \ + oom_create_test \ queue_test \ set_test \ stack_test \ @@ -40,6 +41,10 @@ map_test_CPPFLAGS= -I$(top_builddir)/include/ -I$(top_srcdir)/include/ map_test_LDADD= -lpthread ../src/libcdada.la +oom_create_test_SOURCES= oom_create_test.c +oom_create_test_CPPFLAGS= -I$(top_builddir)/include/ -I$(top_srcdir)/include/ +oom_create_test_LDADD= -lpthread ../src/libcdada.la + queue_test_SOURCES= queue_test.c queue_custom.cc queue_test_CPPFLAGS= -I$(top_builddir)/include/ -I$(top_srcdir)/include/ queue_test_LDADD= -lpthread ../src/libcdada.la @@ -71,6 +76,8 @@ --dsymutil=yes --leak-check=yes \ --leak-check-heuristics=all \ --suppressions=$(top_srcdir)/test/locale.supp +else +TESTS += oom_create_test endif if HAVE_PYTHON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/bbitmap_test.c new/libcdada-0.6.4/test/bbitmap_test.c --- old/libcdada-0.6.3/test/bbitmap_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/bbitmap_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -95,11 +95,13 @@ rv = cdada_bbitmap_dump(b, 128, buffer, &used); TEST_ASSERT(rv == CDADA_E_INCOMPLETE); + TEST_ASSERT(used == 128); fprintf(stderr, "%s\n", buffer); char buffer2[2048*16]; rv = cdada_bbitmap_dump(b, 2048*16, buffer2, &used); TEST_ASSERT(rv == CDADA_SUCCESS); + TEST_ASSERT(used > 128); fprintf(stderr, "%s\n", buffer2); rv = cdada_bbitmap_print(b, stdout); TEST_ASSERT(rv == CDADA_SUCCESS); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/combined_test.c new/libcdada-0.6.4/test/combined_test.c --- old/libcdada-0.6.3/test/combined_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/combined_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -47,6 +47,12 @@ rv = cdada_stack_destroy(stack); TEST_ASSERT(rv == CDADA_SUCCESS); + TEST_ASSERT(strcmp(cdada_strerr(CDADA_SUCCESS), "Success") == 0); + TEST_ASSERT(strcmp(cdada_strerr(CDADA_E_FULL), "Full") == 0); + TEST_ASSERT(strcmp(cdada_strerr(-1), "Invalid code") == 0); + TEST_ASSERT(strcmp(cdada_strerr(CDADA_E_COUNT), "Invalid code") == 0); + TEST_ASSERT(strcmp(cdada_strerr(CDADA_E_COUNT + 1000), "Invalid code") == 0); + //Add your test here, and return a code appropriately... return rv == 0? EXIT_SUCCESS : EXIT_FAILURE; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/list_test.c new/libcdada-0.6.4/test/list_test.c --- old/libcdada-0.6.3/test/list_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/list_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -220,6 +220,7 @@ char buffer2[8]; rv = cdada_list_dump(list, 8, buffer2, &used); TEST_ASSERT(rv == CDADA_E_INCOMPLETE); + TEST_ASSERT(used == 8); fprintf(stdout, "%s\n", buffer2); rv = cdada_list_first(list, &key); @@ -1232,6 +1233,14 @@ rv = cdada_list_remove(list, NULL); TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_list_first(NULL, ptr_not_null); + TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_list_first(list, NULL); + TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_list_last(NULL, ptr_not_null); + TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_list_last(list, NULL); + TEST_ASSERT(rv == CDADA_E_INVALID); //Now destroy rv = cdada_list_destroy(list); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/map_test.c new/libcdada-0.6.4/test/map_test.c --- old/libcdada-0.6.3/test/map_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/map_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -772,6 +772,7 @@ char buffer2[8]; rv = cdada_map_dump(map, 8, buffer2, &used); TEST_ASSERT(rv == CDADA_E_INCOMPLETE); + TEST_ASSERT(used == 8); fprintf(stdout, "%s\n", buffer2); rv = cdada_map_first(map, &key, &tmp); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/oom_create_test.c new/libcdada-0.6.4/test/oom_create_test.c --- old/libcdada-0.6.3/test/oom_create_test.c 1970-01-01 01:00:00.000000000 +0100 +++ new/libcdada-0.6.4/test/oom_create_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -0,0 +1,108 @@ +#include <stdint.h> +#include <stdlib.h> + +#include "cdada/bbitmap.h" +#include "cdada/list.h" +#include "cdada/map.h" +#include "cdada/queue.h" +#include "cdada/set.h" +#include "cdada/stack.h" +#include "cdada/str.h" +#include "common.h" + +static int g_fail_next_malloc = 0; + +#ifdef __GLIBC__ +extern void* __libc_malloc(size_t size); + +void* malloc(size_t size){ + if(g_fail_next_malloc) + return NULL; + return __libc_malloc(size); +} +#endif + +int main(int argc, char** argv){ + cdada_list_t* list; + cdada_map_t* map; + cdada_queue_t* queue; + cdada_set_t* set; + cdada_stack_t* stack; + cdada_str_t* str; + cdada_bbitmap_t* bbitmap; + + (void)argc; + (void)argv; + + g_fail_next_malloc = 0; + list = cdada_list_create(uint32_t); + TEST_ASSERT(list != NULL); + TEST_ASSERT(cdada_list_destroy(list) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + list = cdada_list_create(uint32_t); + g_fail_next_malloc = 0; + TEST_ASSERT(list == NULL); + + g_fail_next_malloc = 0; + map = cdada_map_create(uint32_t); + TEST_ASSERT(map != NULL); + TEST_ASSERT(cdada_map_destroy(map) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + map = cdada_map_create(uint32_t); + g_fail_next_malloc = 0; + TEST_ASSERT(map == NULL); + + g_fail_next_malloc = 0; + queue = cdada_queue_create(uint32_t); + TEST_ASSERT(queue != NULL); + TEST_ASSERT(cdada_queue_destroy(queue) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + queue = cdada_queue_create(uint32_t); + g_fail_next_malloc = 0; + TEST_ASSERT(queue == NULL); + + g_fail_next_malloc = 0; + set = cdada_set_create(uint32_t); + TEST_ASSERT(set != NULL); + TEST_ASSERT(cdada_set_destroy(set) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + set = cdada_set_create(uint32_t); + g_fail_next_malloc = 0; + TEST_ASSERT(set == NULL); + + g_fail_next_malloc = 0; + stack = cdada_stack_create(uint32_t); + TEST_ASSERT(stack != NULL); + TEST_ASSERT(cdada_stack_destroy(stack) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + stack = cdada_stack_create(uint32_t); + g_fail_next_malloc = 0; + TEST_ASSERT(stack == NULL); + + g_fail_next_malloc = 0; + str = cdada_str_create("oom"); + TEST_ASSERT(str != NULL); + TEST_ASSERT(cdada_str_destroy(str) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + str = cdada_str_create("oom"); + g_fail_next_malloc = 0; + TEST_ASSERT(str == NULL); + + g_fail_next_malloc = 0; + bbitmap = cdada_bbitmap_create(64); + TEST_ASSERT(bbitmap != NULL); + TEST_ASSERT(cdada_bbitmap_destroy(bbitmap) == CDADA_SUCCESS); + + g_fail_next_malloc = 1; + bbitmap = cdada_bbitmap_create(64); + g_fail_next_malloc = 0; + TEST_ASSERT(bbitmap == NULL); + + return EXIT_SUCCESS; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/queue_test.c new/libcdada-0.6.4/test/queue_test.c --- old/libcdada-0.6.3/test/queue_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/queue_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -173,6 +173,7 @@ char buffer2[8]; rv = cdada_queue_dump(queue, 8, buffer2, &used); TEST_ASSERT(rv == CDADA_E_INCOMPLETE); + TEST_ASSERT(used == 8); fprintf(stdout, "%s\n", buffer2); TEST_ASSERT(cdada_queue_size(queue) == 6); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/set_test.c new/libcdada-0.6.4/test/set_test.c --- old/libcdada-0.6.3/test/set_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/set_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -109,6 +109,7 @@ char buffer2[8]; rv = cdada_set_dump(set, 8, buffer2, &used); TEST_ASSERT(rv == CDADA_E_INCOMPLETE); + TEST_ASSERT(used == 8); fprintf(stdout, "%s\n", buffer2); rv = cdada_set_first(set, &key); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/stack_test.c new/libcdada-0.6.4/test/stack_test.c --- old/libcdada-0.6.3/test/stack_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/stack_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -148,6 +148,7 @@ char buffer2[8]; rv = cdada_stack_dump(stack, 8, buffer2, &used); TEST_ASSERT(rv == CDADA_E_INCOMPLETE); + TEST_ASSERT(used == 8); fprintf(stdout, "%s\n", buffer2); TEST_ASSERT(cdada_stack_size(stack) == 6); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libcdada-0.6.3/test/str_test.c new/libcdada-0.6.4/test/str_test.c --- old/libcdada-0.6.3/test/str_test.c 2026-01-28 18:58:51.000000000 +0100 +++ new/libcdada-0.6.4/test/str_test.c 2026-02-27 23:40:10.000000000 +0100 @@ -58,7 +58,7 @@ TEST_ASSERT(pos == 15); uint32_t count; - TEST_ASSERT(cdada_str_find_count(s, "TTT", &count) == CDADA_SUCCESS); + TEST_ASSERT(cdada_str_find_count(s, "TTT", &count) == CDADA_E_NOT_FOUND); TEST_ASSERT(count == 0); TEST_ASSERT(cdada_str_find_count(s, "test", &count) == CDADA_SUCCESS); TEST_ASSERT(count == 2); @@ -71,7 +71,7 @@ TEST_ASSERT(a[1] == 15); TEST_ASSERT(cdada_str_find_all(s, "testtttt", 2, a, &count) - == CDADA_SUCCESS); + == CDADA_E_NOT_FOUND); TEST_ASSERT(count == 0); a[0] = a[1] = 1234; @@ -110,10 +110,14 @@ int rv; cdada_str_t * s; const char* ptr; + uint32_t count, poss[2]; void* ptr_not_null = (void*)0x123; //Create + s = cdada_str_create(NULL); + TEST_ASSERT(s == NULL); + s = cdada_str_create("HELLO"); TEST_ASSERT(s != NULL); @@ -136,7 +140,7 @@ TEST_ASSERT(cdada_str_length(NULL) == 0); ptr = cdada_str(NULL); - TEST_ASSERT(strlen(ptr) == 0); + TEST_ASSERT(ptr == NULL); rv = cdada_str_find_first(NULL, (const char*)ptr_not_null, (uint32_t*)ptr_not_null); @@ -165,6 +169,8 @@ rv = cdada_str_find_count(s, (const char*)ptr_not_null, (uint32_t*)NULL); TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_str_find_count(s, "", &count); + TEST_ASSERT(rv == CDADA_E_INVALID); rv = cdada_str_find_all(NULL, (const char*)ptr_not_null, 123, (uint32_t*)ptr_not_null, @@ -186,6 +192,8 @@ (uint32_t*)ptr_not_null, (uint32_t*)NULL); TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_str_find_all(s, "", 2, poss, &count); + TEST_ASSERT(rv == CDADA_E_INVALID); rv = cdada_str_first_c(NULL, (char*)ptr_not_null); TEST_ASSERT(rv == CDADA_E_INVALID); @@ -234,6 +242,8 @@ TEST_ASSERT(rv == CDADA_E_INVALID); rv = cdada_str_erase(s, 2, 55); TEST_ASSERT(rv == CDADA_E_INVALID); + rv = cdada_str_erase(s, 2, 0xFFFFFFFF); + TEST_ASSERT(rv == CDADA_E_INVALID); rv = cdada_str_lower(NULL); TEST_ASSERT(rv == CDADA_E_INVALID); @@ -337,6 +347,30 @@ rv = cdada_str_replace_all(s, "TEST", "HIGHFIVE"); TEST_ASSERT(strcmp(cdada_str(s), "ANOTHER HIGHFIVE HIGHFIVE HIGHFIVE HIGHFIVE XX YYY XY") == 0); + rv = cdada_str_set(s, "aaaa"); + TEST_ASSERT(rv == CDADA_SUCCESS); + rv = cdada_str_replace_all(s, "a", "aa"); + TEST_ASSERT(rv == CDADA_SUCCESS); + TEST_ASSERT(strcmp(cdada_str(s), "aaaaaaaa") == 0); + + rv = cdada_str_set(s, "abc"); + TEST_ASSERT(rv == CDADA_SUCCESS); + rv = cdada_str_replace_all(s, "", "x"); + TEST_ASSERT(rv == CDADA_E_INVALID); + TEST_ASSERT(strcmp(cdada_str(s), "abc") == 0); + + rv = cdada_str_set(s, "abc123123xyz"); + TEST_ASSERT(rv == CDADA_SUCCESS); + rv = cdada_str_replace_all(s, "123", "1"); + TEST_ASSERT(rv == CDADA_SUCCESS); + TEST_ASSERT(strcmp(cdada_str(s), "abc11xyz") == 0); + + rv = cdada_str_set(s, "xxxx"); + TEST_ASSERT(rv == CDADA_SUCCESS); + rv = cdada_str_replace_all(s, "xx", "x"); + TEST_ASSERT(rv == CDADA_SUCCESS); + TEST_ASSERT(strcmp(cdada_str(s), "xx") == 0); + rv = cdada_str_set(s, "Another test TEST TEST tEsT xx YYY XY"); TEST_ASSERT(rv == CDADA_SUCCESS); rv = cdada_str_replace(s, "TESTt", "HIGHFIVE", 13);
