aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2023-11-12 02:16:17 +0100
committerPaul B Mahol <onemda@gmail.com>2023-11-12 02:19:53 +0100
commit10440a489af0dd8a6e1cd8cfdcaa81473569868a (patch)
tree1285de01d646630c2982786d6adbda17e44508f6
parent553b31da68402e6e4c9b243cf33f30c89bdeabca (diff)
downloadffmpeg-10440a489af0dd8a6e1cd8cfdcaa81473569868a.tar.gz
avcodec/gif_parser: split correctly also bitstreams that do not have extension blocks
-rw-r--r--libavcodec/gif_parser.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/libavcodec/gif_parser.c b/libavcodec/gif_parser.c
index aa07585f4c..f5903585fa 100644
--- a/libavcodec/gif_parser.c
+++ b/libavcodec/gif_parser.c
@@ -67,6 +67,17 @@ static int gif_find_frame_end(GIFParseContext *g, const uint8_t *buf,
g->state = GIF_EXTENSION;
g->found_start = pc->frame_start_found = 1;
} else if (buf[index] == GIF_IMAGE_SEPARATOR) {
+ if (g->state != GIF_EXTENSION_BLOCK && g->found_start &&
+ g->found_end && g->found_sig) {
+ next = index;
+ g->found_start = pc->frame_start_found = 1;
+ g->found_end = 0;
+ g->index = 0;
+ g->gct_flag = 0;
+ g->gct_size = 0;
+ g->state = GIF_IMAGE;
+ break;
+ }
g->state = GIF_IMAGE;
} else if (buf[index] == GIF_TRAILER) {
g->state = 0;