summaryrefslogtreecommitdiff
path: root/src/libnsgif.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-02-21 18:49:43 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2022-02-21 18:49:43 +0000
commit6d39a8f70009c43032d96da8ceb8934e6e67a159 (patch)
tree1cc649bf2edec238185c3f20e43a1c8f8144d153 /src/libnsgif.c
parent696b29ffeb71d77f9ede7dd19408cf713923684a (diff)
downloadlibnsgif-6d39a8f70009c43032d96da8ceb8934e6e67a159.tar.gz
libnsgif-6d39a8f70009c43032d96da8ceb8934e6e67a159.tar.bz2
gif: Frame parse: Only grow image to accommodate first frame.
This matches the behaviour of other browsers.
Diffstat (limited to 'src/libnsgif.c')
-rw-r--r--src/libnsgif.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/libnsgif.c b/src/libnsgif.c
index 2b53492..25f98c6 100644
--- a/src/libnsgif.c
+++ b/src/libnsgif.c
@@ -877,9 +877,15 @@ static gif_result gif__parse_image_descriptor(
frame->redraw_width = w;
frame->redraw_height = h;
- /* Frame size may have grown. */
- gif->width = (x + w > gif->width ) ? x + w : gif->width;
- gif->height = (y + h > gif->height) ? y + h : gif->height;
+ /* Allow first frame to grow image dimensions. */
+ if (gif->frame_count == 0) {
+ if (x + w > gif->width) {
+ gif->width = x + w;
+ }
+ if (y + h > gif->height) {
+ gif->height = y + h;
+ }
+ }
}
*pos += GIF_IMAGE_DESCRIPTOR_LEN;