srdja / Collections-C

A library of generic data structures for the C language.
http://srdja.github.io/Collections-C
GNU Lesser General Public License v3.0
2.8k stars 328 forks source link

The call to mem_alloc in cc_array_subarray() is unsafe #160

Open kbridge opened 1 year ago

kbridge commented 1 year ago

https://github.com/srdja/Collections-C/blob/5285da8dcd3dbfe32f960abc7bf287db0d2600c5/src/cc_array.c#L479

Because ar->capacity * sizeof(void*) can overflow. Should use ar->mem_calloc.