babl: avoid potential NULL deref of malloc result in ICC code
authorØyvind Kolås <pippin@gimp.org>
Sat, 13 Jun 2020 21:20:42 +0000 (23:20 +0200)
committerØyvind Kolås <pippin@gimp.org>
Sun, 28 Jun 2020 15:28:32 +0000 (17:28 +0200)
babl/babl-icc.c

index 96cc1664d13208b9d9e5d58522e1c8270adaabf4..a21888f702bdc77e85e13164eeb482cb2bb8c264 100644 (file)
@@ -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