summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@samsung.com>2019-04-23 09:38:12 -0400
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-04-23 17:48:41 +0200
commit0ebf41c003ea89f10c45ae7a2e53c68302c05103 (patch)
treef485571b0f536833d8f5bb12ae563a4077c7481b
parentf215108bea699ff1b63afe4350fde626b8e4f661 (diff)
downloadefl-0ebf41c003ea89f10c45ae7a2e53c68302c05103.tar.gz
evas-wbmp: revert previous two patches
Revert "evas wbmp: remove unnecessary size overflow." This reverts commit 1061d0a75164111ef5dc8df21f446023438f39bc. Revert "evas image: check format more strong way for wbmp." This reverts commit 68fe9ec6bf60b4730ad7fdbf2698dc7aa130b94d. 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
-rw-r--r--src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c b/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
index 7f56da6d02..633afe9567 100644
--- a/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
+++ b/src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c
@@ -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++)