Modify the initial value of fd to '-1' 60/257160/2 accepted/tizen/unified/20210422.090519 submit/tizen/20210421.015919
authorjiyong.min <jiyong.min@samsung.com>
Tue, 20 Apr 2021 04:24:23 +0000 (13:24 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 20 Apr 2021 07:04:54 +0000 (16:04 +0900)
[Problem]
 An error may occur in the operation of the application.
[Cause]
 When the 'heif_source_h' was created from buffer, fd was initialized to '0'.
 It caused fd '0' close when the 'heif_source_h' freed.
 It closed fd '0' being used for other purpose.
[Solution]
 The initial value of fd in 'heif_source_h' was modified to '-1'.
 So if fd is not used in 'heif_source_h' then close is not called.

Change-Id: I2ddc44a886ea14ee1fd44603c5a55a11bced869b

packaging/libheif.spec
src/heif_source.c

index 58d25e1..d0baed6 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libheif
 Summary:    Multimedia Framework Library for HEIF(ISO/IEC 23008-12) image
-Version:    0.0.1
+Version:    0.0.2
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 99649a7..970f4e5 100644 (file)
@@ -56,6 +56,7 @@ int heif_source_create_from_file(const char *path, heif_source_h *source)
 #endif
 
        new_source = g_new0(heif_source_t, 1);
+       new_source->fd = -1;
 
        ret = __source_set_path(new_source, path);
        if (ret != LIBHEIF_ERROR_NONE) {
@@ -80,6 +81,7 @@ int heif_source_create_from_buffer(unsigned char *buf, size_t size, heif_source_
 #endif
 
        new_source = g_new0(heif_source_t, 1);
+       new_source->fd = -1;
 
        ret = __source_set_buffer(new_source, buf, size);
        if (ret != LIBHEIF_ERROR_NONE) {