From: Andrzej Popowski Date: Mon, 4 May 2015 08:45:50 +0000 (+0200) Subject: [exif] - Updated the codes fixing a prevent issue for error handling from slp X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d4bc391f29f0b237f60d805e6806f454b0073d6a;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [exif] - Updated the codes fixing a prevent issue for error handling from slp Change-Id: I4181d0af91035ed358c8eb2335c1acb099d2fcfa Signed-off-by: Andrzej Popowski --- diff --git a/src/exif/jpeg_file.cc b/src/exif/jpeg_file.cc index 8570eee9..168575a0 100644 --- a/src/exif/jpeg_file.cc +++ b/src/exif/jpeg_file.cc @@ -148,7 +148,14 @@ PlatformResult JpegFile::load(const std::string& path) { } fseek(m_in_file, 0, SEEK_END); - const std::size_t in_file_size = static_cast(ftell(m_in_file)); + + long ftell_val = ftell(m_in_file); + if (0 > ftell_val) { + LoggerE("Input file [%s] access error! [%d]", path.c_str(), errno); + return PlatformResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid"); + } + + const std::size_t in_file_size = static_cast(ftell_val); fseek(m_in_file, 0, SEEK_SET); LoggerD("JPEG file: [%s] size:%d", path.c_str(), in_file_size); if (0 == in_file_size) {