summaryrefslogtreecommitdiff
path: root/tests/test_document.cpp
diff options
context:
space:
mode:
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);