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)
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,
73 position++; /* skipping one byte */ 73 position++; /* skipping one byte */
74 if (read_mb(&w, map, length, &position) < 0) goto bail; 74 if (read_mb(&w, map, length, &position) < 0) goto bail;
75 if (read_mb(&h, map, length, &position) < 0) goto bail; 75 if (read_mb(&h, map, length, &position) < 0) goto bail;
76
77 /* Wbmp header identifier is too weak....
78 Here checks size validation whether it's acutal wbmp or not. */
79 if (((w * h) >> 3) + position != length)
80 {
81 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
82 goto bail;
83 }
84
85 if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) || 76 if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
86 IMG_TOO_BIG(w, h)) 77 IMG_TOO_BIG(w, h))
87 { 78 {
@@ -125,20 +116,11 @@ evas_image_load_file_data_wbmp(void *loader_data,
125 if (!map) goto bail; 116 if (!map) goto bail;
126 117
127 if (read_mb(&type, map, length, &position) < 0) goto bail; 118 if (read_mb(&type, map, length, &position) < 0) goto bail;
128
129 if (type != 0)
130 {
131 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
132 goto bail;
133 }
134
135 position++; /* skipping one byte */ 119 position++; /* skipping one byte */
136 if (read_mb(&w, map, length, &position) < 0) goto bail; 120 if (read_mb(&w, map, length, &position) < 0) goto bail;
137 if (read_mb(&h, map, length, &position) < 0) goto bail; 121 if (read_mb(&h, map, length, &position) < 0) goto bail;
138 122
139 /* Wbmp header identifier is too weak.... 123 if (type != 0)
140 Here checks size validation whether it's acutal wbmp or not. */
141 if (((w * h) >> 3) + position != length)
142 { 124 {
143 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; 125 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
144 goto bail; 126 goto bail;
@@ -163,6 +145,7 @@ evas_image_load_file_data_wbmp(void *loader_data,
163 145
164 for (y = 0; y < (int)prop->h; y++) 146 for (y = 0; y < (int)prop->h; y++)
165 { 147 {
148 if (position + line_length > length) goto bail;
166 line = ((unsigned char*) map) + position; 149 line = ((unsigned char*) map) + position;
167 position += line_length; 150 position += line_length;
168 for (x = 0; x < (int)prop->w; x++) 151 for (x = 0; x < (int)prop->w; x++)