]> git.eshelyaron.com Git - emacs.git/commitdiff
Check decoding results in webp_load before using it
authorLars Ingebrigtsen <larsi@gnus.org>
Wed, 8 Dec 2021 00:38:25 +0000 (01:38 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Wed, 8 Dec 2021 00:38:39 +0000 (01:38 +0100)
* src/image.c (webp_load): Check whether we were able to decode
the image before using it.

src/image.c

index 65bf22b98149394d0c241c8df17cdad304047894..cd0f3f697f8298a35b4272c644bf116531b82ecc 100644 (file)
@@ -9039,6 +9039,12 @@ webp_load (struct frame *f, struct image *img)
     /* Linear [r0, g0, b0, r1, g1, b1, ...] order.  */
     decoded = WebPDecodeRGB (contents, size, &width, &height);
 
+  if (!decoded)
+    {
+      image_error ("Error when interpreting WebP image data");
+      goto webp_error1;
+    }
+
   if (!(width <= INT_MAX && height <= INT_MAX
        && check_image_size (f, width, height)))
     {