[gdk-pixbuf] io-jasper.c: Validate jas_matrix_create result



commit 60e8eae82b2b93d6c018fa195e999d7504b29c35
Author: Ivan A. Melnikov <iv altlinux org>
Date:   Tue Jan 15 15:03:14 2019 +0400

    io-jasper.c: Validate jas_matrix_create result
    
    jas_matrix_create can return NULL when memory allocation
    fails.
    
    Closes: #107

 gdk-pixbuf/io-jasper.c | 8 ++++++++
 1 file changed, 8 insertions(+)
---
diff --git a/gdk-pixbuf/io-jasper.c b/gdk-pixbuf/io-jasper.c
index f916cbf64..af4296147 100644
--- a/gdk-pixbuf/io-jasper.c
+++ b/gdk-pixbuf/io-jasper.c
@@ -223,6 +223,14 @@ jasper_image_try_load (struct jasper_context *context, GError **error)
 
                matrix = jas_matrix_create (context->height, context->width);
 
+               if (matrix == NULL) {
+                       g_set_error_literal (error,
+                                             GDK_PIXBUF_ERROR,
+                                             GDK_PIXBUF_ERROR_INSUFFICIENT_MEMORY,
+                                             _("Insufficient memory to open JPEG 2000 file"));
+                       return FALSE;
+               }
+
                /* in libjasper, R is 0, G is 1, etc. we're lucky :)
                 * but we need to handle the "opacity" channel ourselves */
                if (i != 4) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]