From 2537cccad34b64086ad2ff47db07c3674b9be07a Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Sun, 12 Apr 2015 02:17:20 -0700 Subject: tests: Fix some Coverity issues --- tests/test_document.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'tests/test_document.cpp') 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(ftell(file)); + long length = ftell(file); fseek(file, 0, SEEK_SET); + CHECK(length >= 0); + size = static_cast(length); data = new char[size]; CHECK(fread(data, 1, size, file) == size); -- cgit v1.2.3