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

array_reverse: fix unsigned overflow #128

Closed ZirconXi closed 4 years ago

ZirconXi commented 4 years ago

This fixes a bug in the array reverse function. when the array is empty, ar->size - 1 will overflow. This situation causes the array to be out of bounds.