evas-wbmp: revert previous two patches

Revert "evas wbmp: remove unnecessary size overflow."
This reverts commit 1061d0a751.
Revert "evas image: check format more strong way for wbmp."
This reverts commit 68fe9ec6bf.

this caused wbmp files to no longer be loadable

ref T7824

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8689
This commit is contained in:
Mike Blumenkrantz 2019-04-23 09:38:12 -04:00 committed by Marcel Hollerbach
parent f215108bea
commit 0ebf41c003
1 changed files with 2 additions and 19 deletions

View File

@ -73,15 +73,6 @@ evas_image_load_file_head_wbmp(void *loader_data,
position++; /* skipping one byte */
if (read_mb(&w, map, length, &position) < 0) goto bail;
if (read_mb(&h, map, length, &position) < 0) goto bail;
/* Wbmp header identifier is too weak....
Here checks size validation whether it's acutal wbmp or not. */
if (((w * h) >> 3) + position != length)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto bail;
}
if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
IMG_TOO_BIG(w, h))
{
@ -125,20 +116,11 @@ evas_image_load_file_data_wbmp(void *loader_data,
if (!map) goto bail;
if (read_mb(&type, map, length, &position) < 0) goto bail;
if (type != 0)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto bail;
}
position++; /* skipping one byte */
if (read_mb(&w, map, length, &position) < 0) goto bail;
if (read_mb(&h, map, length, &position) < 0) goto bail;
/* Wbmp header identifier is too weak....
Here checks size validation whether it's acutal wbmp or not. */
if (((w * h) >> 3) + position != length)
if (type != 0)
{
*error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
goto bail;
@ -163,6 +145,7 @@ evas_image_load_file_data_wbmp(void *loader_data,
for (y = 0; y < (int)prop->h; y++)
{
if (position + line_length > length) goto bail;
line = ((unsigned char*) map) + position;
position += line_length;
for (x = 0; x < (int)prop->w; x++)