From e6b074ad214abb6bb563c1762934631ad0ecc2d4 Mon Sep 17 00:00:00 2001 From: Artem Popov Date: Fri, 11 Nov 2016 09:57:38 -0800 Subject: eet: add to basic eet_image EAPIs checking on NULL @fix Summary: to avoid segfaults with NULL raw data, add checking on NULL to basic eet_image APIS Reviewers: NikaWhite, cedric, myoungwoon, jpeg Reviewed By: jpeg Subscribers: t.naumenko, jpeg Differential Revision: https://phab.enlightenment.org/D4386 Signed-off-by: Cedric Bail --- src/lib/eet/eet_image.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/lib/eet/eet_image.c b/src/lib/eet/eet_image.c index 1da7985d99..b77d90e510 100644 --- a/src/lib/eet/eet_image.c +++ b/src/lib/eet/eet_image.c @@ -1577,6 +1577,9 @@ eet_data_image_encode_cipher(const void *data, unsigned int ciphered_sz = 0; int size = 0; + if (!data) + return NULL; + switch (lossy) { case EET_IMAGE_LOSSLESS: @@ -1688,6 +1691,9 @@ eet_data_image_header_advance_decode_cipher(const void *data, unsigned int deciphered_sz = 0; int r = 0; + if (!data) + return NULL; + if (cipher_key) { if (!eet_decipher(data, size, cipher_key, strlen(cipher_key), @@ -2083,6 +2089,9 @@ eet_data_image_decode_cipher(const void *data, void *deciphered_d = NULL; unsigned int deciphered_sz = 0; + if (!data) + return NULL; + if (cipher_key) { if (!eet_decipher(data, size, cipher_key, strlen(cipher_key), @@ -2171,6 +2180,9 @@ eet_data_image_decode_to_cspace_surface_cipher(const void *data, void *deciphered_d = NULL; unsigned int deciphered_sz = 0; + if (!data) + return NULL; + if (cipher_key) { if (!eet_decipher(data, size, cipher_key, strlen(cipher_key), -- cgit v1.2.1