Commit aaa68295 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

windowscodecs: GIF decoder should append a sub-block to current extension.

parent 880b98bf
......@@ -222,6 +222,32 @@ AddExtensionBlock(Extensions *New,
return (GIF_OK);
}
static int
AppendExtensionBlock(Extensions *New,
int Len,
const unsigned char ExtData[])
{
ExtensionBlock *ep;
if (New->ExtensionBlocks == NULL)
return (GIF_ERROR);
ep = &New->ExtensionBlocks[New->ExtensionBlockCount - 1];
ep->Bytes = ungif_realloc(ep->Bytes, ep->ByteCount + Len + 1);
if (ep->Bytes == NULL)
return (GIF_ERROR);
if (ExtData)
{
ep->Bytes[ep->ByteCount] = Len;
memcpy(ep->Bytes + ep->ByteCount + 1, ExtData, Len);
ep->ByteCount += Len + 1;
}
return (GIF_OK);
}
static void
FreeExtension(Extensions *Extensions)
{
......@@ -898,16 +924,30 @@ DGifSlurp(GifFileType * GifFile) {
Extensions->Function = Function;
/* Create an extension block with our data */
if (AddExtensionBlock(Extensions, ExtData[0], &ExtData[1]) == GIF_ERROR)
return (GIF_ERROR);
while (ExtData != NULL) {
int Len;
GifByteType *Data;
/* Create an extension block with our data */
if (AddExtensionBlock(Extensions, ExtData[0], &ExtData[1])
== GIF_ERROR)
if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR)
return (GIF_ERROR);
if (DGifGetExtensionNext(GifFile, &ExtData) == GIF_ERROR)
if (ExtData)
{
Len = ExtData[0];
Data = &ExtData[1];
}
else
{
Len = 0;
Data = NULL;
}
if (AppendExtensionBlock(Extensions, Len, Data) == GIF_ERROR)
return (GIF_ERROR);
temp_save.Function = 0;
}
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment