Simon Thelen <fo...@c-...>:
> Hello,
>
> When opening a gif file using giflib the RunningBits member of
> GifFilePrivateType is never initialized before access in
> DGifSetupDecompress (called from DGifGetImageDesc) causing the function
> to occasionally set GifFile->Error = D_GIF_ERR_READ_FAILED and return
> GIF_ERROR even though no actual error occurred.
>
> I've attached a patch that initializes RunningBits to 0 in
> DGifOpenFileHandle, but it might be safer to memset Private to 0 after
> allocating with malloc as there might other variables that are accessed
> without initialization that I haven't hit.
>
> Since I am not currently subscribed to the mailing list, please CC me in
> replies to this mail (though I will try and check the mailing list
> archives periodically).
>
> --
> Simon Thelen
> --- lib/dgif_lib.c.orig 2016-01-16 22:04:46.645036386 +0100
> +++ lib/dgif_lib.c 2016-01-16 22:05:37.752384125 +0100
> @@ -109,6 +109,7 @@
> Private->File = f;
> Private->FileState = FILE_STATE_READ;
> Private->Read = NULL; /* don't use alternate input method (TVT) */
> + Private->RunningBits = 0; /* Make sure to initialize RunningBits */
> GifFile->UserData = NULL; /* TVT */
> /*@=mustfreeonly@*/
>
I think the memset is a better idea, and have pushed that change.
--
<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>
|