Skip to content

Commit 6f97295

Browse files
committed
set: fix find() returning true on internal error
This code was technically reachable but practically unreachable (value length not supported). Anyway, return CDADA_E_UNKNOWN. Reported-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Marc Suñé <marcdevel@gmail.com>
1 parent b7d0ad2 commit 6f97295

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ Legend:
1919
- [B] str: align `cdada_str()` invalid-handle behavior with API docs (return `NULL`, not empty string)
2020
- [B] bbitmap: make `cdada_bbitmap_dump()` set `size_used` in buffered paths too
2121
- [B] bbitmap: fix corrupted BSD license header in `bbitmap.h`
22-
- [B] str: fix uint32_t underflow in `cdada_str_rtraverse()` on empty strings
22+
- [B] str: fix underflow in `cdada_str_rtraverse()` on empty strings
2323
- [B] list: fix `cdada_list_first()`/`cdada_list_last()` returning `CDADA_SUCCESS` on invalid input
24+
- [B] set: fix `cdada_set_find()` returning `true` on internal error
2425
- [O] tests: add coverage for `cdada_strerr()` valid, boundary and high invalid values
2526
- [O] tests: add `oom_create_test` coverage for create paths (`list`, `map`, `queue`, `set`, `stack`, `str`, `bbitmap`)
2627
- [O] tests: add coverage for `cdada_str_replace_all()` empty-match invalid input and self-overlap replacement

src/set.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ bool cdada_set_find(const cdada_set_t* set, const void* key){
448448
return (*m->ops->find)(m, key);
449449
default:
450450
CDADA_ASSERT(0);
451-
return CDADA_E_UNKNOWN;
451+
return false;
452452
}
453453
}catch(...){}
454454

0 commit comments

Comments
 (0)