From: Piotr Kosko/Native/Web API (SWP) /SRPOL/Professional/삼성전자
Date: Wed, 16 Jan 2019 08:45:10 +0000 (+0100)
Subject: [Archive][Exif] Added checking return value of fseek
X-Git-Tag: submit/tizen/20190116.121828^2^2^2~1
X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F197780%2F2;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git
[Archive][Exif] Added checking return value of fseek
SVACE issues: 246302, 246317
Change-Id: If4f803b9db18c352912290b25df706a21cd07853
Signed-off-by: Piotr Kosko/Native/Web API (SWP) /SRPOL/Professional/삼성전자
---
diff --git a/src/archive/zip_add_request.cc b/src/archive/zip_add_request.cc
index d6e862f3..583bfead 100644
--- a/src/archive/zip_add_request.cc
+++ b/src/archive/zip_add_request.cc
@@ -358,9 +358,14 @@ PlatformResult ZipAddRequest::addToZipArchive(filesystem::NodePtr src_file_node)
}
// Get file length
- fseek(m_input_file, 0, SEEK_END);
+ int res = fseek(m_input_file, 0, SEEK_END);
+ if (0 != res) {
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Reading input file failed",
+ ("fseek failed with error! [%d]", res));
+ }
+
const size_t in_file_size = ftell(m_input_file);
- int res = fseek(m_input_file, 0, SEEK_SET);
+ res = fseek(m_input_file, 0, SEEK_SET);
if (0 != res) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Reading input file failed",
("fseek failed with error! [%d]", res));
diff --git a/src/exif/jpeg_file.cc b/src/exif/jpeg_file.cc
index 39bf00c7..a391e73f 100644
--- a/src/exif/jpeg_file.cc
+++ b/src/exif/jpeg_file.cc
@@ -161,7 +161,12 @@ PlatformResult JpegFile::load(const std::string& path) {
}
const std::size_t in_file_size = static_cast(ftell_val);
- fseek(m_in_file, 0, SEEK_SET);
+ res = fseek(m_in_file, 0, SEEK_SET);
+ if (0 != res) {
+ return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Reading JPEG file failed",
+ ("fseek failed with error! [%d]", res));
+ }
+
LoggerD("JPEG file: [%s] size:%d", path.c_str(), in_file_size);
if (0 == in_file_size) {
return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "JPEG file is invalid",