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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 FPDF_FFLDraw(form, bitmap.get(), page.get(), 0, 0, width, height, 0, 0); | 215 FPDF_FFLDraw(form, bitmap.get(), page.get(), 0, 0, width, height, 0, 0); |
216 } | 216 } |
217 FORM_DoPageAAction(page.get(), form, FPDFPAGE_AACTION_CLOSE); | 217 FORM_DoPageAAction(page.get(), form, FPDFPAGE_AACTION_CLOSE); |
218 FORM_OnBeforeClosePage(page.get(), form); | 218 FORM_OnBeforeClosePage(page.get(), form); |
219 return !!bitmap; | 219 return !!bitmap; |
220 } | 220 } |
221 | 221 |
222 // Initialize the library once for all runs of the fuzzer. | 222 // Initialize the library once for all runs of the fuzzer. |
223 struct TestCase { | 223 struct TestCase { |
224 TestCase() { | 224 TestCase() { |
| 225 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
225 InitializeV8ForPDFium(ProgramPath(), "", &natives_blob, &snapshot_blob, | 226 InitializeV8ForPDFium(ProgramPath(), "", &natives_blob, &snapshot_blob, |
226 &platform); | 227 &platform); |
| 228 #else |
| 229 InitializeV8ForPDFium(ProgramPath(), &platform); |
| 230 #endif |
227 | 231 |
228 memset(&config, '\0', sizeof(config)); | 232 memset(&config, '\0', sizeof(config)); |
229 config.version = 2; | 233 config.version = 2; |
230 config.m_pUserFontPaths = nullptr; | 234 config.m_pUserFontPaths = nullptr; |
231 config.m_pIsolate = nullptr; | 235 config.m_pIsolate = nullptr; |
232 config.m_v8EmbedderSlot = 0; | 236 config.m_v8EmbedderSlot = 0; |
233 FPDF_InitLibraryWithConfig(&config); | 237 FPDF_InitLibraryWithConfig(&config); |
234 | 238 |
235 memset(&unsupport_info, '\0', sizeof(unsupport_info)); | 239 memset(&unsupport_info, '\0', sizeof(unsupport_info)); |
236 unsupport_info.version = 1; | 240 unsupport_info.version = 1; |
237 unsupport_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler; | 241 unsupport_info.FSDK_UnSupport_Handler = ExampleUnsupportedHandler; |
238 FSDK_SetUnSpObjProcessHandler(&unsupport_info); | 242 FSDK_SetUnSpObjProcessHandler(&unsupport_info); |
239 } | 243 } |
240 | 244 |
241 v8::Platform* platform; | 245 v8::Platform* platform; |
242 v8::StartupData natives_blob; | 246 v8::StartupData natives_blob; |
243 v8::StartupData snapshot_blob; | 247 v8::StartupData snapshot_blob; |
244 FPDF_LIBRARY_CONFIG config; | 248 FPDF_LIBRARY_CONFIG config; |
245 UNSUPPORT_INFO unsupport_info; | 249 UNSUPPORT_INFO unsupport_info; |
246 }; | 250 }; |
247 static TestCase* testCase = new TestCase(); | 251 static TestCase* testCase = new TestCase(); |
OLD | NEW |