Bug fix. add missing DGifCloseFile() for invalid width/height 51/317851/4
authorJiyong <jiyong.min@samsung.com>
Thu, 9 Jan 2025 02:47:01 +0000 (11:47 +0900)
committerJiyong <jiyong.min@samsung.com>
Thu, 9 Jan 2025 05:27:47 +0000 (14:27 +0900)
Change-Id: I3288d0e932452a13b6158b54bbd06fabbb996d28

gif/mm_util_gif.c

index cb06fd7dac46838595c60bc82db42189a2ee2b17..13f388ad65b1c1e5938e59ce8147190747dbb395 100644 (file)
@@ -227,7 +227,11 @@ static int __read_gif(const char *file_path, void *memory, const size_t src_size
        ret = __gif_open(file_path, memory, src_size, &io_buf, &GifFile);
        mm_util_retvm_if(ret != MM_UTIL_ERROR_NONE, ret, "__gif_open failed");
 
-       mm_util_retvm_if(GifFile->SWidth <= 0 || GifFile->SHeight <= 0, MM_UTIL_ERROR_INVALID_OPERATION, "Gif File wrong decode width & height");
+       if (GifFile->SWidth <= 0 || GifFile->SHeight <= 0) {
+               mm_util_error("Gif image has invalid width(%d), height(%d)", GifFile->SWidth, GifFile->SHeight);
+               DGifCloseFile(GifFile, NULL);
+               return MM_UTIL_ERROR_INVALID_OPERATION;
+       }
 
        __gif_generate_frame_buffer(GifFile, &frame_buffer);