[patch] zipcmp: fix call of qsort with null pointe,
- Re: [patch] zipcmp: fix call of qsort with null po, Thomas Klausner (2016/10/18 22:37:15)
On Tue, Oct 18, 2016 at 04:47:17PM +0200, Hanno Böck wrote: > qsort() requires to be called with a valid pointer. For an empty zip > file zipcmp will try to sort an empty list with 0 elements. > undefined behavior sanitizer throws a warning about this > (-fsanitize=undefined in cflags), test with > zipcmp testempty.zip testempty.zip (from the regress dir) > > error message: > zipcmp.c:228:8: runtime error: null pointer passed as argument 1, which is > declared to never be null > /usr/include/stdlib.h:765:30: note: nonnull attribute specified here > SUMMARY: AddressSanitizer: undefined-behavior zipcmp.c:228:8 in > > > Attached patch checks for this and fixes it. Thank you, committed! Thomas
Made by MHonArc.