Commit b4923aaa authored by Guillaume Roguez's avatar Guillaume Roguez Committed by gerrit2

fileutils: fix bad numeric comparison in loadFile

The file size was wrongly checked in loadFile,
giving a always true comparaison.

(issue detected by analysis)

Change-Id: I2aa4f5c737df3a3b815caebc97bdc3820df8b534
Tuleap: #909
parent fe12fa8a
......@@ -259,8 +259,8 @@ loadFile(const std::string& path)
if (!file)
throw std::runtime_error("Can't read file: "+path);
file.seekg(0, std::ios::end);
std::streamsize size = file.tellg();
if ((unsigned)size > std::numeric_limits<unsigned>::max())
auto size = file.tellg();
if (size > std::numeric_limits<unsigned>::max())
throw std::runtime_error("File is too big: "+path);
file.seekg(0, std::ios::beg);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment