summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-12 02:17:20 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-04-12 02:17:20 -0700
commit2537cccad34b64086ad2ff47db07c3674b9be07a (patch)
treeec6e58f10042b3c8a9da1542d890152491ed3624 /tests/test_document.cpp
parentd6f7766172bd3dcd6b286888f5bdfdcb1953f3ba (diff)
tests: Fix some Coverity issues
Diffstat (limited to 'tests/test_document.cpp')
-rw-r--r--tests/test_document.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/test_document.cpp b/tests/test_document.cpp
index 2c52030..d81458a 100644
--- a/tests/test_document.cpp
+++ b/tests/test_document.cpp
@@ -32,9 +32,11 @@ static bool load_file_in_memory(const char* path, char*& data, size_t& size)
if (!file) return false;
fseek(file, 0, SEEK_END);
- size = static_cast<size_t>(ftell(file));
+ long length = ftell(file);
fseek(file, 0, SEEK_SET);
+ CHECK(length >= 0);
+ size = static_cast<size_t>(length);
data = new char[size];
CHECK(fread(data, 1, size, file) == size);