Return value of a functions 'fstat' and 'fseek' is not checked.
The return value may indicate error code.
Signed-off-by: y.novikov <y.novikov@partner.samsung.com>
}
stat st{};
- fstat(fd, &st);
+ int flag = fstat(fd, &st);
+ if (flag == -1)
+ {
+ return;
+ }
numBytes = st.st_size;
auto f = fopen(clopt::interInputData.c_str(), "rb");
assert(f && "Cannot open file");
- fseek(f, 0L, SEEK_END);
+ bool is_error = fseek(f, 0L, SEEK_END);
+ assert(!is_error);
+ (void)is_error;
auto len = ftell(f);
auto tensorSize = num_elements(shape) * sizeof(float);
#include <iostream>
#include <fstream>
+#include <cassert>
int fileToArray(std::string &source, std::string &dest, std::string arrName) {
FILE *fs = fopen(source.c_str(), "rb");
fo << "const char " << arrName << "[] = {" << std::endl;
- fseek(fs, 0, SEEK_SET);
+ bool is_error = fseek(fs, 0L, SEEK_SET);
+ assert(!is_error);
+ (void)is_error;
size_t bytes;
do {
char buf[1024];