by reza_n · 8y ago · 0 comments
int new_capacity = vec->capacity * 2;
assert(new_capacity > vec->capacity);But if you are a C programmer and speaking honestly, you need to have a better understanding of undefined behavior in C before you write any more code. Checking for signed overflow in C is extremely difficult to do correctly. This is a good starting point: https://blog.regehr.org/archives/213.
Not sure I understand why you think the assert() gets removed. Is this documented somewhere?
Hint: vec->capacity could be 0
I found out about it through https://github.com/rohe/pysaml2/issues/451