diff options
Diffstat (limited to 'testing/test_loader.cpp')
-rw-r--r-- | testing/test_loader.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/testing/test_loader.cpp b/testing/test_loader.cpp index aac8429a0..a3fad8a47 100644 --- a/testing/test_loader.cpp +++ b/testing/test_loader.cpp @@ -6,7 +6,8 @@ #include <string.h> -#include "third_party/base/notreached.h" +#include "third_party/base/check_op.h" +#include "third_party/base/numerics/checked_math.h" TestLoader::TestLoader(pdfium::span<const char> span) : m_Span(span) {} @@ -16,10 +17,9 @@ int TestLoader::GetBlock(void* param, unsigned char* pBuf, unsigned long size) { TestLoader* pLoader = static_cast<TestLoader*>(param); - if (pos + size < pos || pos + size > pLoader->m_Span.size()) { - NOTREACHED(); - return 0; - } + pdfium::base::CheckedNumeric<size_t> end = pos; + end += size; + CHECK_LE(end.ValueOrDie(), pLoader->m_Span.size()); memcpy(pBuf, &pLoader->m_Span[pos], size); return 1; |