summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHermet Park <hermetpark@gmail.com>2019-04-24 10:10:36 +0900
committerHermet Park <hermetpark@gmail.com>2019-04-24 10:10:36 +0900
commit54754ab8781f78cc2e768c6f067b1418f4066b8e (patch)
tree248fd20816d3df71a283a0de9b439fc89bb57111
parentcaa1542610a7073706f5e5200d58075ea83b04b1 (diff)
Revert "evas-wbmp: revert previous two patches"
This reverts commit 0ebf41c003ea89f10c45ae7a2e53c68302c05103.
-rw-r--r--src/modules/evas/image_loaders/wbmp/evas_image_load_wbmp.c21
1 files changed, 19 insertions, 2 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 633afe9567..7f56da6d02 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,6 +73,15 @@ 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
76 if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) || 85 if ((w < 1) || (h < 1) || (w > IMG_MAX_SIZE) || (h > IMG_MAX_SIZE) ||
77 IMG_TOO_BIG(w, h)) 86 IMG_TOO_BIG(w, h))
78 { 87 {
@@ -116,11 +125,20 @@ evas_image_load_file_data_wbmp(void *loader_data,
116 if (!map) goto bail; 125 if (!map) goto bail;
117 126
118 if (read_mb(&type, map, length, &position) < 0) goto bail; 127 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
119 position++; /* skipping one byte */ 135 position++; /* skipping one byte */
120 if (read_mb(&w, map, length, &position) < 0) goto bail; 136 if (read_mb(&w, map, length, &position) < 0) goto bail;
121 if (read_mb(&h, map, length, &position) < 0) goto bail; 137 if (read_mb(&h, map, length, &position) < 0) goto bail;
122 138
123 if (type != 0) 139 /* Wbmp header identifier is too weak....
140 Here checks size validation whether it's acutal wbmp or not. */
141 if (((w * h) >> 3) + position != length)
124 { 142 {
125 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT; 143 *error = EVAS_LOAD_ERROR_UNKNOWN_FORMAT;
126 goto bail; 144 goto bail;
@@ -145,7 +163,6 @@ evas_image_load_file_data_wbmp(void *loader_data,
145 163
146 for (y = 0; y < (int)prop->h; y++) 164 for (y = 0; y < (int)prop->h; y++)
147 { 165 {
148 if (position + line_length > length) goto bail;
149 line = ((unsigned char*) map) + position; 166 line = ((unsigned char*) map) + position;
150 position += line_length; 167 position += line_length;
151 for (x = 0; x < (int)prop->w; x++) 168 for (x = 0; x < (int)prop->w; x++)