mirror of
https://pdfium.googlesource.com/pdfium
synced 2026-07-31 02:43:52 +08:00
Remove the per-directory suppression, and suppress individual lines in the files originated by PDFium. Help to avoid new unsafe usage from being added in any future CLs. Change-Id: I6b8591ecbf74c4857a02c6f4c28167bde0ce890d Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/149130 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
29 lines
869 B
C++
29 lines
869 B
C++
// Copyright 2019 The PDFium Authors
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#include "testing/test_loader.h"
|
|
|
|
#include <stddef.h>
|
|
|
|
#include "core/fxcrt/check_op.h"
|
|
#include "core/fxcrt/compiler_specific.h"
|
|
#include "core/fxcrt/fx_memcpy_wrappers.h"
|
|
#include "core/fxcrt/numerics/checked_math.h"
|
|
|
|
TestLoader::TestLoader(pdfium::span<const uint8_t> span) : span_(span) {}
|
|
|
|
// static
|
|
int TestLoader::GetBlock(void* param,
|
|
unsigned long pos,
|
|
unsigned char* pBuf,
|
|
unsigned long size) {
|
|
TestLoader* pLoader = static_cast<TestLoader*>(param);
|
|
pdfium::CheckedNumeric<size_t> end = pos;
|
|
end += size;
|
|
CHECK_LE(end.ValueOrDie(), pLoader->span_.size());
|
|
|
|
UNSAFE_TODO(FXSYS_memcpy(pBuf, &pLoader->span_[pos], size));
|
|
return 1;
|
|
}
|