summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhj kim <backto.kim@samsung.com>2019-09-16 06:17:31 (GMT)
committerhj kim <backto.kim@samsung.com>2019-09-16 07:11:58 (GMT)
commit3451eeb8f10aadb6aec2fa6981f7a9f2e1fd9e81 (patch)
tree6905b5887f07f89f1a226e5be316a8bb8ba4eb47 /src
parente00db9e711125bb169a49c46456ad7083cb243d2 (diff)
downloadlibmedia-thumbnail-3451eeb8f10aadb6aec2fa6981f7a9f2e1fd9e81.zip
libmedia-thumbnail-3451eeb8f10aadb6aec2fa6981f7a9f2e1fd9e81.tar.gz
libmedia-thumbnail-3451eeb8f10aadb6aec2fa6981f7a9f2e1fd9e81.tar.bz2
Fix Coverity issuerefs/changes/73/213873/3
Change-Id: Ia4cd11b915f333a18b31e90d29710d6b1bf32dca
Diffstat (limited to 'src')
-rwxr-xr-xsrc/include/media-thumb-internal.h2
-rwxr-xr-xsrc/media-thumb-internal.c13
2 files changed, 10 insertions, 5 deletions
diff --git a/src/include/media-thumb-internal.h b/src/include/media-thumb-internal.h
index b0f84fe..2b9b271 100755
--- a/src/include/media-thumb-internal.h
+++ b/src/include/media-thumb-internal.h
@@ -47,7 +47,7 @@ typedef struct {
void *user_data;
} thumbRawUserData;
-int _media_thumb_image(const char *origin_path, char *thumb_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info);
+int _media_thumb_image(const char *origin_path, char *thumb_path, unsigned int thumb_width, unsigned int thumb_height, media_thumb_info *thumb_info);
int _media_thumb_video(const char *origin_path, const char *thumb_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info);
int _media_thumb_get_hash_name(const char *file_full_path, char *thumb_hash_path, size_t max_thumb_path, uid_t uid);
diff --git a/src/media-thumb-internal.c b/src/media-thumb-internal.c
index 9899783..3b3016e 100755
--- a/src/media-thumb-internal.c
+++ b/src/media-thumb-internal.c
@@ -32,10 +32,15 @@
#include <mm_file.h>
#include <mm_util_magick.h>
-static void __media_thumb_get_proper_thumb_size(int origin_width, int origin_height, int *thumb_width, int *thumb_height)
+static void __media_thumb_get_proper_thumb_size(unsigned int origin_width, unsigned int origin_height, unsigned int *thumb_width, unsigned int *thumb_height)
{
bool portrait = false;
- double ratio;
+ double ratio = 0.0;
+
+ thumb_retm_if(origin_width == 0, "Invalid origin_width");
+ thumb_retm_if(origin_height == 0, "Invalid origin_height");
+ thumb_retm_if(!thumb_width, "Invalid thumb_width");
+ thumb_retm_if(!thumb_height, "Invalid thumb_height");
if (origin_width < origin_height)
portrait = true;
@@ -88,7 +93,7 @@ int _media_thumb_general(const char *origin_path, const char *thumb_path, int th
return err;
}
-int _media_thumb_image(const char *origin_path, char *thumb_path, int thumb_width, int thumb_height, media_thumb_info *thumb_info)
+int _media_thumb_image(const char *origin_path, char *thumb_path, unsigned int thumb_width, unsigned int thumb_height, media_thumb_info *thumb_info)
{
int err = MS_MEDIA_ERR_NONE;
mm_util_img_codec_type image_type = 0;
@@ -257,7 +262,7 @@ static int __get_video_info(int cdis_value, const char *origin_path, int *video_
return MS_MEDIA_ERR_NONE;
}
-static int __get_video_thumb(int width, int height, void *frame, size_t size, mm_util_magick_rotate_type rot_type, const char *thumb_path, int thumb_width, int thumb_height, mm_util_image_h *dst_img)
+static int __get_video_thumb(int width, int height, void *frame, size_t size, mm_util_magick_rotate_type rot_type, const char *thumb_path, unsigned int thumb_width, unsigned int thumb_height, mm_util_image_h *dst_img)
{
int err = MS_MEDIA_ERR_NONE;
mm_util_image_h img = NULL;