List Archive

Thread

Thread Index

Message

From: Thomas Klausner <tk%giga.or.at@localhost>
To: Hanno Böck <hanno%hboeck.de@localhost>
Subject: Re: [patch] zipcmp: fix call of qsort with null pointer
Date: Wed, 19 Oct 2016 00:37:14 +0200

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.