summaryrefslogtreecommitdiff
path: root/testing/libfuzzer/pdf_font_fuzzer.cc
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2018-04-25 18:49:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-25 18:49:32 +0000
commite08d2b1fee0db40bac9538ca8b7be0a951675bd6 (patch)
tree81ded468a54adb247f46d7824632f6c4a537619c /testing/libfuzzer/pdf_font_fuzzer.cc
parenteb3ec8f29846a5df67269a53ca94d1d740c84513 (diff)
downloadpdfium-e08d2b1fee0db40bac9538ca8b7be0a951675bd6.tar.xz
Introduce ScopedFPDF types in public/cpp/fpdf_scopers.h
Applies std::remove_ptr to the public API types so that we can deduce a correct unique ptr type no matter how that API might change away from void* usage. Creates shorter names for std::unique_ptr<std::remove_pointer<>, ...> Change-Id: I04a0ff43cb7d5a4d3867939a53a54c9cef00db86 Reviewed-on: https://pdfium-review.googlesource.com/31292 Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'testing/libfuzzer/pdf_font_fuzzer.cc')
-rw-r--r--testing/libfuzzer/pdf_font_fuzzer.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/testing/libfuzzer/pdf_font_fuzzer.cc b/testing/libfuzzer/pdf_font_fuzzer.cc
index aed66613fa..7c596307f0 100644
--- a/testing/libfuzzer/pdf_font_fuzzer.cc
+++ b/testing/libfuzzer/pdf_font_fuzzer.cc
@@ -5,7 +5,7 @@
#include <cstring>
#include <memory>
-#include "public/cpp/fpdf_deleters.h"
+#include "public/cpp/fpdf_scopers.h"
#include "public/fpdf_edit.h"
#include "public/fpdfview.h"
@@ -13,15 +13,13 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
if (size < 2)
return 0;
- std::unique_ptr<void, FPDFDocumentDeleter> doc(FPDF_CreateNewDocument());
- std::unique_ptr<void, FPDFPageDeleter> page(
- FPDFPage_New(doc.get(), 0, 612, 792));
+ ScopedFPDFDocument doc(FPDF_CreateNewDocument());
+ ScopedFPDFPage page(FPDFPage_New(doc.get(), 0, 612, 792));
int font_type = data[0];
FPDF_BOOL cid = data[1];
data += 2;
size -= 2;
- std::unique_ptr<void, FPDFFontDeleter> font(
- FPDFText_LoadFont(doc.get(), data, size, font_type, cid));
+ ScopedFPDFFont font(FPDFText_LoadFont(doc.get(), data, size, font_type, cid));
if (!font)
return 0;