| OLD | NEW |
| 1 // Copyright 2016 The PDFium Authors. All rights reserved. | 1 // Copyright 2016 The PDFium 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 #include <cstdint> | 5 #include <cstdint> |
| 6 | 6 |
| 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" | 7 #include "core/fpdfapi/fpdf_parser/cpdf_stream.h" |
| 8 #include "core/fpdfapi/fpdf_parser/include/cpdf_stream_acc.h" | 8 #include "core/fpdfapi/fpdf_parser/cpdf_stream_acc.h" |
| 9 #include "core/fxcodec/JBig2_DocumentContext.h" |
| 9 #include "core/fxcodec/codec/ccodec_jbig2module.h" | 10 #include "core/fxcodec/codec/ccodec_jbig2module.h" |
| 10 #include "core/fxcodec/include/JBig2_DocumentContext.h" | |
| 11 #include "core/fxcodec/jbig2/JBig2_Context.h" | 11 #include "core/fxcodec/jbig2/JBig2_Context.h" |
| 12 #include "core/fxge/include/fx_dib.h" | 12 #include "core/fxge/fx_dib.h" |
| 13 | 13 |
| 14 static uint32_t GetInteger(const uint8_t* data) { | 14 static uint32_t GetInteger(const uint8_t* data) { |
| 15 return data[0] | data[1] << 8 | data[2] << 16 | data[3] << 24; | 15 return data[0] | data[1] << 8 | data[2] << 16 | data[3] << 24; |
| 16 } | 16 } |
| 17 | 17 |
| 18 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { | 18 extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| 19 const size_t kParameterSize = 8; | 19 const size_t kParameterSize = 8; |
| 20 if (size < kParameterSize) | 20 if (size < kParameterSize) |
| 21 return 0; | 21 return 0; |
| 22 | 22 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 CCodec_Jbig2Context jbig2_context; | 39 CCodec_Jbig2Context jbig2_context; |
| 40 std::unique_ptr<JBig2_DocumentContext> document_context; | 40 std::unique_ptr<JBig2_DocumentContext> document_context; |
| 41 FXCODEC_STATUS status = module.StartDecode( | 41 FXCODEC_STATUS status = module.StartDecode( |
| 42 &jbig2_context, &document_context, width, height, &src_stream, nullptr, | 42 &jbig2_context, &document_context, width, height, &src_stream, nullptr, |
| 43 bitmap->GetBuffer(), bitmap->GetPitch(), nullptr); | 43 bitmap->GetBuffer(), bitmap->GetPitch(), nullptr); |
| 44 | 44 |
| 45 while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE) | 45 while (status == FXCODEC_STATUS_DECODE_TOBECONTINUE) |
| 46 status = module.ContinueDecode(&jbig2_context, nullptr); | 46 status = module.ContinueDecode(&jbig2_context, nullptr); |
| 47 return 0; | 47 return 0; |
| 48 } | 48 } |
| OLD | NEW |