diff options
author | Ivan A. Melnikov <iv@altlinux.org> | 2019-01-15 15:03:14 +0400 |
---|---|---|
committer | Ivan A. Melnikov <iv@altlinux.org> | 2019-02-27 22:41:30 +0400 |
commit | 60e8eae82b2b93d6c018fa195e999d7504b29c35 (patch) | |
tree | e36be930d323c18fa4d2408cd0c2847bc6cc8687 /gdk-pixbuf | |
parent | 2f71ebebdfb650c8a777b57ffb201a844b9e9bac (diff) | |
download | gdk-pixbuf-60e8eae82b2b93d6c018fa195e999d7504b29c35.tar.gz |
io-jasper.c: Validate jas_matrix_create result
jas_matrix_create can return NULL when memory allocation
fails.
Closes: #107
Diffstat (limited to 'gdk-pixbuf')
-rw-r--r-- | gdk-pixbuf/io-jasper.c | 8 |
1 files changed, 8 insertions, 0 deletions
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) { |