cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=95467e57077df3d08cd6ac52981eb743c2cd8fde

commit 95467e57077df3d08cd6ac52981eb743c2cd8fde
Author: jiin.moon <jiin.m...@samsung.com>
Date:   Mon Sep 21 23:44:49 2015 +0200

    emile: fix can not check ifd offset of jpeg in MM(little endian) format
    
    IFD offset is 4 byte.
    But just one byte is checked for it in previous patch.
    
    Reviewers: Hermet, jypark, cedric
    
    Reviewed By: cedric
    
    Subscribers: cedric
    
    Differential Revision: https://phab.enlightenment.org/D3053
    
    Signed-off-by: Cedric BAIL <ced...@osg.samsung.com>
---
 src/lib/emile/emile_image.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/lib/emile/emile_image.c b/src/lib/emile/emile_image.c
index 4b0feff..0e184d6 100644
--- a/src/lib/emile/emile_image.c
+++ b/src/lib/emile/emile_image.c
@@ -897,14 +897,15 @@ _get_orientation_app1(const unsigned char *map,
         return EINA_TRUE;
      }
 
-   /* 2. get 14th byte get info for IFD offset */
-   /* 3. get 10&11 byte  get info of "II(0x4949)" or "MM(0x4d4d)" */
+   /* 2. get 10&11 byte  get info of "II(0x4949)" or "MM(0x4d4d)" */
+   /* 3. get 14th - 17th byte get info for IFD offset */
    /* 4. get directory entry IFD */
 
-   ifd_offset += *(buf + 14);
 
    if (!memcmp(buf + 10, MM, sizeof(MM)))
      {
+        // get 4byte by little endian
+        ifd_offset += (*(buf + 14) << 24) + (*(buf + 15) << 16) + (*(buf + 16) 
<< 8) + (*(buf + 17));
         byte_align = EXIF_BYTE_ALIGN_MM;
         num_directory = ((*(buf + ifd_offset) << 8) + *(buf + ifd_offset + 1));
         orientation[0] = 0x01;
@@ -912,6 +913,8 @@ _get_orientation_app1(const unsigned char *map,
      }
    else if (!memcmp(buf + 10, II, sizeof(II)))
      {
+        // get 4byte by big endian
+        ifd_offset += (*(buf + 14))  + (*(buf + 15) << 8) + (*(buf + 16) << 
16) + (*(buf + 17) << 24);
         byte_align = EXIF_BYTE_ALIGN_II;
         num_directory = ((*(buf + ifd_offset + 1) << 8) + *(buf + ifd_offset));
         orientation[0] = 0x12;

-- 


Reply via email to