[babl] babl: avoid potential NULL deref of malloc result in ICC code



commit d2d6af505ea08dba342b6e3d2833bb548ff604fa
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Jun 13 23:20:42 2020 +0200

    babl: avoid potential NULL deref of malloc result in ICC code

 babl/babl-icc.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/babl/babl-icc.c b/babl/babl-icc.c
index 96cc1664d..a21888f70 100644
--- a/babl/babl-icc.c
+++ b/babl/babl-icc.c
@@ -960,6 +960,8 @@ babl_space_from_icc (const char   *icc_data,
          return ret;
        ret->space.icc_length = icc_length;
        ret->space.icc_profile = malloc (icc_length);
+       if (!ret->space.icc_profile)
+         return NULL;
        memcpy (ret->space.icc_profile, icc_data, icc_length);
 
 #ifdef HAVE_LCMS


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