OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This fuzzer is simplified & cleaned up pdfium/samples/pdfium_test.cc | 5 // This fuzzer is simplified & cleaned up pdfium/samples/pdfium_test.cc |
6 | 6 |
7 #include "pdf/pdfium/fuzzers/pdfium_fuzzer_helper.h" | 7 #include "pdf/pdfium/fuzzers/pdfium_fuzzer_helper.h" |
8 | 8 |
9 #include <assert.h> | 9 #include <assert.h> |
10 #include <limits.h> | 10 #include <limits.h> |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 nRet = FPDFAvail_IsPageAvail(pdf_avail.get(), i, &hints); | 185 nRet = FPDFAvail_IsPageAvail(pdf_avail.get(), i, &hints); |
186 | 186 |
187 if (nRet == PDF_DATA_ERROR) | 187 if (nRet == PDF_DATA_ERROR) |
188 return; | 188 return; |
189 } | 189 } |
190 RenderPage(doc.get(), form.get(), i); | 190 RenderPage(doc.get(), form.get(), i); |
191 } | 191 } |
192 FORM_DoDocumentAAction(form.get(), FPDFDOC_AACTION_WC); | 192 FORM_DoDocumentAAction(form.get(), FPDFDOC_AACTION_WC); |
193 } | 193 } |
194 | 194 |
195 bool PDFiumFuzzerHelper::RenderPage(const FPDF_DOCUMENT& doc, | 195 bool PDFiumFuzzerHelper::RenderPage(FPDF_DOCUMENT doc, |
196 const FPDF_FORMHANDLE& form, | 196 FPDF_FORMHANDLE form, |
197 const int page_index) { | 197 const int page_index) { |
198 std::unique_ptr<void, FPDFPageDeleter> page(FPDF_LoadPage(doc, page_index)); | 198 std::unique_ptr<void, FPDFPageDeleter> page(FPDF_LoadPage(doc, page_index)); |
199 if (!page) | 199 if (!page) |
200 return false; | 200 return false; |
201 | 201 |
202 std::unique_ptr<void, FPDFTextPageDeleter> text_page( | 202 std::unique_ptr<void, FPDFTextPageDeleter> text_page( |
203 FPDFText_LoadPage(page.get())); | 203 FPDFText_LoadPage(page.get())); |
204 FORM_OnAfterLoadPage(page.get(), form); | 204 FORM_OnAfterLoadPage(page.get(), form); |
205 FORM_DoPageAAction(page.get(), form, FPDFPAGE_AACTION_OPEN); | 205 FORM_DoPageAAction(page.get(), form, FPDFPAGE_AACTION_OPEN); |
206 | 206 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 FSDK_SetUnSpObjProcessHandler(&unsupport_info); | 242 FSDK_SetUnSpObjProcessHandler(&unsupport_info); |
243 } | 243 } |
244 | 244 |
245 v8::Platform* platform; | 245 v8::Platform* platform; |
246 v8::StartupData natives_blob; | 246 v8::StartupData natives_blob; |
247 v8::StartupData snapshot_blob; | 247 v8::StartupData snapshot_blob; |
248 FPDF_LIBRARY_CONFIG config; | 248 FPDF_LIBRARY_CONFIG config; |
249 UNSUPPORT_INFO unsupport_info; | 249 UNSUPPORT_INFO unsupport_info; |
250 }; | 250 }; |
251 static TestCase* testCase = new TestCase(); | 251 static TestCase* testCase = new TestCase(); |
OLD | NEW |