Modify the size of the buffer for rotating or cropping image 72/159072/3 accepted/tizen/unified/20171108.063455 submit/tizen/20171107.034519
authorJiyong Min <jiyong.min@samsung.com>
Tue, 7 Nov 2017 01:13:51 +0000 (10:13 +0900)
committerJiyong Min <jiyong.min@samsung.com>
Tue, 7 Nov 2017 01:47:50 +0000 (10:47 +0900)
 - Problem:
   Crash happen when image is rotated or cropped.

 - Cause & Solution:
   Because of removing the get resolution function at 'https://review.tizen.org/gerrit/#/c/158301/'.
   The size of 'dst' buffer is '0'.
   The size of buffer should be calculated by the width and height of source.

Change-Id: I1d87e51648a70504c754f99cca2fd8ce6b378c6d
Signed-off-by: Jiyong Min <jiyong.min@samsung.com>
imgp/mm_util_imgp.c
packaging/libmm-utility.spec

index 1e02879557ad0830f71abd5fafa74b207d6f13a3..2b960a012441c561c9f6b1669185a9a11e7f4bea 100755 (executable)
@@ -1097,7 +1097,7 @@ static int __mm_util_processing(mm_util_s *handle)
 
        if (handle->set_convert) {
                dst_index++;
-               mm_util_get_image_size(handle->dst_format, handle->dst_width, handle->dst_height, &dst_buf_size);
+               mm_util_get_image_size(handle->dst_format, src_width, src_height, &dst_buf_size);
                dst_buf[dst_index] = g_malloc(dst_buf_size);
                if (dst_buf[dst_index] == NULL) {
                        mm_util_error("[multi func] memory allocation error");
@@ -1121,15 +1121,15 @@ static int __mm_util_processing(mm_util_s *handle)
                        switch (handle->dst_rotation) {
                        case  MM_UTIL_ROTATION_90:
                        case MM_UTIL_ROTATION_270:
-                               temp_swap = handle->dst_width;
-                               handle->dst_width  = handle->dst_height;
-                               handle->dst_height = temp_swap;
+                               temp_swap = src_width;
+                               src_width  = src_height;
+                               src_height = temp_swap;
                                break;
                        default:
                                break;
                        }
                }
-               mm_util_get_image_size(src_format, handle->dst_width, handle->dst_height, &dst_buf_size);
+               mm_util_get_image_size(src_format, src_width, src_height, &dst_buf_size);
                dst_buf[dst_index] = g_malloc(dst_buf_size);
                if (dst_buf[dst_index] == NULL) {
                        mm_util_error("[multi func] memory allocation error");
index 16d26c585464deec2144241cb512a23655371d84..f0ac97a92d66ab3d3fd030e136436a7bcce28bc2 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       libmm-utility
 Summary:    Multimedia Framework Utility Library
-Version:    0.45
+Version:    0.46
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0