summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-03-03 19:06:33 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2022-03-03 19:15:28 +0000
commit81e55f826dba3b749fd20f3bbd1d42ca42494732 (patch)
treed2546a9c872f8fc2073ec206ad81e059e77cb3d0
parentd8bd0736b06045ff7591e4db27cf4cd8a6ca929b (diff)
downloadlibnsgif-81e55f826dba3b749fd20f3bbd1d42ca42494732.tar.gz
libnsgif-81e55f826dba3b749fd20f3bbd1d42ca42494732.tar.bz2
GIF: Fix frame background colour disposal for frame clipping.
-rw-r--r--src/gif.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gif.c b/src/gif.c
index 637d0ae..d2f6c61 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -625,13 +625,15 @@ static void nsgif__restore_bg(
uint32_t offset_x = frame->info.rect.x0;
uint32_t offset_y = frame->info.rect.y0;
- width -= gif__clip(offset_x, width, gif->info.width);
- height -= gif__clip(offset_y, height, gif->info.height);
-
- if (frame->info.display == false || width == 0) {
+ if (frame->info.display == false ||
+ frame->info.rect.x0 >= gif->info.width ||
+ frame->info.rect.y0 >= gif->info.height) {
return;
}
+ width -= gif__clip(offset_x, width, gif->info.width);
+ height -= gif__clip(offset_y, height, gif->info.height);
+
if (frame->info.transparency) {
for (uint32_t y = 0; y < height; y++) {
uint32_t *scanline = bitmap + offset_x +