summaryrefslogtreecommitdiff
path: root/testing
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-18 16:22:41 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-18 16:22:41 -0800
commit0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch)
tree07c55fac710b191cf5d1d6595c63b90ca52e3cbb /testing
parent430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff)
downloadpdfium-0e606b5ecd6e45f74391f110cc1fe0cce0e80c64.tar.xz
Make CPDF_Dictionary use unique pointers.chromium/2926
Some changes were required to match underlying ctors as invoked by the templated methods. Many release() calls go away, a few WrapUniques() are introduced to avoid going deeper into other code. Review-Url: https://codereview.chromium.org/2510223002
Diffstat (limited to 'testing')
-rw-r--r--testing/libfuzzer/pdf_hint_table_fuzzer.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/testing/libfuzzer/pdf_hint_table_fuzzer.cc b/testing/libfuzzer/pdf_hint_table_fuzzer.cc
index 15e04d9b3d..b31d56eb8f 100644
--- a/testing/libfuzzer/pdf_hint_table_fuzzer.cc
+++ b/testing/libfuzzer/pdf_hint_table_fuzzer.cc
@@ -5,6 +5,7 @@
#include <cstdint>
#include "core/fpdfapi/parser/cpdf_array.h"
+#include "core/fpdfapi/parser/cpdf_boolean.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_hint_tables.h"
#include "core/fpdfapi/parser/cpdf_linearized_header.h"
@@ -62,15 +63,15 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
auto linearized_dict = pdfium::MakeUnique<CPDF_Dictionary>();
// Set initial value.
- linearized_dict->SetBooleanFor("Linearized", true);
+ linearized_dict->SetNewFor<CPDF_Boolean>("Linearized", true);
// Set first page end offset
- linearized_dict->SetIntegerFor("E", GetData(&data32, &data, &size));
+ linearized_dict->SetNewFor<CPDF_Number>("E", GetData(&data32, &data, &size));
// Set page count
- linearized_dict->SetIntegerFor("N", GetData(&data32, &data, &size));
+ linearized_dict->SetNewFor<CPDF_Number>("N", GetData(&data32, &data, &size));
// Set first page obj num
- linearized_dict->SetIntegerFor("O", GetData(&data32, &data, &size));
+ linearized_dict->SetNewFor<CPDF_Number>("O", GetData(&data32, &data, &size));
// Set first page no
- linearized_dict->SetIntegerFor("P", GetData(&data32, &data, &size));
+ linearized_dict->SetNewFor<CPDF_Number>("P", GetData(&data32, &data, &size));
auto hint_info = pdfium::MakeUnique<CPDF_Array>();
// Add primary hint stream offset
@@ -78,7 +79,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
// Add primary hint stream size
hint_info->AddNew<CPDF_Number>(GetData(&data32, &data, &size));
// Set hint stream info.
- linearized_dict->SetFor("H", hint_info.release());
+ linearized_dict->SetFor("H", std::move(hint_info));
const int shared_hint_table_offset = GetData(&data32, &data, &size);