| |
@@ -0,0 +1,29 @@
|
| |
+ From e4b777c7b7c144cd16a0ea96108267b1004fe6c9 Mon Sep 17 00:00:00 2001
|
| |
+ From: Hans Petter Jansson <hpj@hpjansson.org>
|
| |
+ Date: Sun, 24 Apr 2022 23:56:53 +0200
|
| |
+ Subject: [PATCH] libnsgif: Fix null pointer deref on frameless GIF input
|
| |
+
|
| |
+ A crafted GIF file with no frame data could cause a null pointer
|
| |
+ dereference leading to denial of service (crash). Reported by
|
| |
+ @JieyongMa via huntr.dev.
|
| |
+ ---
|
| |
+ libnsgif/libnsgif.c | 6 ++++++
|
| |
+ 1 file changed, 6 insertions(+)
|
| |
+
|
| |
+ diff --git a/libnsgif/libnsgif.c b/libnsgif/libnsgif.c
|
| |
+ index fc4bda2..fa55d7b 100644
|
| |
+ --- a/libnsgif/libnsgif.c
|
| |
+ +++ b/libnsgif/libnsgif.c
|
| |
+ @@ -595,6 +595,12 @@ gif_internal_decode_frame(gif_animation *gif,
|
| |
+ unsigned int x, y, decode_y, burst_bytes;
|
| |
+ register unsigned char colour;
|
| |
+
|
| |
+ + /* If the GIF has no frame data, frame holders will not be allocated in
|
| |
+ + * gif_initialise() */
|
| |
+ + if (gif->frames == NULL) {
|
| |
+ + return GIF_INSUFFICIENT_DATA;
|
| |
+ + }
|
| |
+ +
|
| |
+ /* Ensure this frame is supposed to be decoded */
|
| |
+ if (gif->frames[frame].display == false) {
|
| |
+ return GIF_OK;
|
| |