add null checks to WebPDecodeBGRA() returns in webp loader

SPANK SPANK, IGOR!


SVN revision: 76521
This commit is contained in:
Mike Blumenkrantz 2012-09-12 12:13:08 +00:00
parent d9dae5b06b
commit 86e07547f1
2 changed files with 11 additions and 0 deletions

View File

@ -98,6 +98,12 @@ evas_image_load_file_data_webp(Evas_Img_Load_Params *ilp, const char *file, cons
fclose(f);
decoded = WebPDecodeBGRA(data, file_size, &width, &height);
if (!decoded)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
free(data);
goto close_file;
}
memcpy(ilp->buffer, decoded, width * height * 4);
evas_cserve2_image_premul(ilp);

View File

@ -116,6 +116,11 @@ evas_image_load_file_data_webp(Image_Entry *ie, const char *file, const char *ke
}
decoded = WebPDecodeBGRA(data, file_size, &width, &height);
if (!decoded)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto free_data;
}
memcpy(surface, decoded, width * height * 4);
evas_common_image_premul(ie);