Skip to content

Commit 9889e73

Browse files
Laurence BankLaurence Bank
authored andcommitted
patched fixes that were accidentally removed
1 parent dd37b58 commit 9889e73

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/AnimatedGIF.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ long lTime = millis();
196196
if (GIFParseInfo(&_gif, 0))
197197
{
198198
_gif.pUser = pUser;
199+
if (_gif.iError == GIF_EMPTY_FRAME) // don't try to decode it
200+
return 0;
199201
rc = DecodeLZW(&_gif, 0);
200202
if (rc != 0) // problem
201203
return -1;

src/gif.inl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ static int GIFParseInfo(GIFIMAGE *pPage, int bInfoOnly)
317317
}
318318
}
319319
}
320-
while (p[iOffset] != ',') /* Wait for image separator */
320+
while (p[iOffset] != ',' && p[iOffset] != ';') /* Wait for image separator */
321321
{
322322
if (p[iOffset] == '!') /* Extension block */
323323
{
@@ -416,6 +416,11 @@ static int GIFParseInfo(GIFIMAGE *pPage, int bInfoOnly)
416416
return 0;
417417
}
418418
} /* while */
419+
if (p[iOffset] == ';') { // end of file, quit and return a correct error code
420+
pPage->iError = GIF_EMPTY_FRAME;
421+
return 1;
422+
}
423+
419424
if (p[iOffset] == ',')
420425
iOffset++;
421426
// This particular frame's size and position on the main frame (if animated)

0 commit comments

Comments
 (0)