fix bmp decoding error. other tool like GIMP
authorJiyoun Park <jijibe99@gmail.com>
Wed, 12 Sep 2012 16:34:45 +0000 (16:34 +0000)
committerJiyoun Park <jijibe99@gmail.com>
Wed, 12 Sep 2012 16:34:45 +0000 (16:34 +0000)
can handle image size error

SVN revision: 76546

legacy/evas/src/modules/loaders/bmp/evas_image_load_bmp.c

index 9453ceb..562f172 100644 (file)
@@ -456,7 +456,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         comp = tmp2; // compression method
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
-        image_size = tmp2; // bitmap data size
+        if (tmp2 <= image_size) image_size = tmp2; // bitmap data size, GIMP can handle image size error
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@@ -484,7 +484,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         comp = tmp2; // compression method
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
-        image_size = tmp2; // bitmap data size
+        if (tmp2 <= image_size) image_size = tmp2; // bitmap data size, GIMP can handle image size error
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@@ -512,7 +512,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         comp = tmp2; // compression method
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
-        image_size = tmp2; // bitmap data size
+        if (tmp2 <= image_size) image_size = tmp2; // bitmap data size, GIMP can handle image size error
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
@@ -550,7 +550,7 @@ evas_image_load_file_data_bmp(Image_Entry *ie, const char *file, const char *key
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         comp = tmp2; // compression method
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
-        image_size = tmp2; // bitmap data size
+        if (tmp2 <= image_size) image_size = tmp2; // bitmap data size, GIMP can handle image size error
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;
         //hdpi = (tmp2 * 254) / 10000; // horizontal pixels/meter
         if (!read_int(map, fsize, &position, &tmp2)) goto close_file;