[pacman-dev] [PATCH] Ensure filelist realloc uses positive size

Allan McRae allan at archlinux.org
Tue Nov 18 02:03:14 UTC 2014


On 18/11/14 02:20, Andrew Gregory wrote:
> On 11/18/14 at 12:51am, Allan McRae wrote:
>> A corrupt local db filelist could result in a realloc of size zero.
> 
> Maybe I'm missing something...  Calling realloc with size zero should free the
> memory and return NULL, which seems like the right thing to do if there are no
> files.
> 

You are correct.  I thought a realloc(foo, 0) was undefined like
malloc(0) is. I guess this is a false positive in the clang analyser.

Allan


More information about the pacman-dev mailing list