projects
/
platform
/
upstream
/
csr-framework.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
41c1990
)
Add file io error handling in sample engine
66/73966/1
author
Kyungwook Tak
<k.tak@samsung.com>
Fri, 10 Jun 2016 08:04:03 +0000
(17:04 +0900)
committer
Kyungwook Tak
<k.tak@samsung.com>
Fri, 10 Jun 2016 08:04:32 +0000
(17:04 +0900)
Change-Id: I7dcf87abad15983444ca1595bce306612849f7d6
Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
test/engine/content-screening/sample-engine.cpp
patch
|
blob
|
history
diff --git
a/test/engine/content-screening/sample-engine.cpp
b/test/engine/content-screening/sample-engine.cpp
index
88cbeb2
..
c5e83d5
100644
(file)
--- a/
test/engine/content-screening/sample-engine.cpp
+++ b/
test/engine/content-screening/sample-engine.cpp
@@
-206,11
+206,15
@@
int csret_cs_read_binary(const std::string &path, RawBuffer &buffer)
f.seekg(0, f.end);
auto len = f.tellg();
+ if (len == -1) {
+ buffer.clear();
+ return CSRET_CS_ERROR_FILE_IO;
+ }
+
f.seekg(0, f.beg);
buffer.resize(len, 0);
f.read(reinterpret_cast<char *>(buffer.data()), buffer.size());
-
if (!f) {
buffer.clear();
return CSRET_CS_ERROR_FILE_IO;
@@
-455,7
+459,6
@@
int csre_cs_scan_app_on_cloud(csre_cs_context_h handle,
if (!dirp)
return CSRE_ERROR_FILE_NOT_FOUND;
-
struct dirent entry;
struct dirent *result;