| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 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 "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" | 5 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 "\x80\x30\x8a\xd2\xb9\xf4\xdd\x0d\x14\xd2\x8b\xc1\x46\x99\x59\x1a" | 66 "\x80\x30\x8a\xd2\xb9\xf4\xdd\x0d\x14\xd2\x8b\xc1\x46\x99\x59\x1a" |
| 67 "\x2b\x58\x1a\x9a\x83\x8c\x49\xe3\x0a\x04\x42\x00\x37\x4c\x1b\x42", | 67 "\x2b\x58\x1a\x9a\x83\x8c\x49\xe3\x0a\x04\x42\x00\x37\x4c\x1b\x42", |
| 68 "1 0 0 -1 29 763 cm\n0 0 555 735 re\nW n\nq\n0 0 555 734.394 re\n" | 68 "1 0 0 -1 29 763 cm\n0 0 555 735 re\nW n\nq\n0 0 555 734.394 re\n" |
| 69 "W n\nq\n0.8009 0 0 0.8009 0 0 cm\n1 1 1 RG 1 1 1 rg\n/G0 gs\n" | 69 "W n\nq\n0.8009 0 0 0.8009 0 0 cm\n1 1 1 RG 1 1 1 rg\n/G0 gs\n" |
| 70 "0 0 693 917 re\nf\nQ\nQ\n", | 70 "0 0 693 917 re\nf\nQ\nQ\n", |
| 71 96), | 71 96), |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 for (size_t i = 0; i < FX_ArraySize(flate_decode_cases); ++i) { | 74 for (size_t i = 0; i < FX_ArraySize(flate_decode_cases); ++i) { |
| 75 const pdfium::DecodeTestData& data = flate_decode_cases[i]; | 75 const pdfium::DecodeTestData& data = flate_decode_cases[i]; |
| 76 unsigned char* result; | 76 unsigned char* result = nullptr; |
| 77 unsigned int result_size; | 77 unsigned int result_size; |
| 78 EXPECT_EQ(data.processed_size, | 78 EXPECT_EQ(data.processed_size, |
| 79 FlateDecode(data.input, data.input_size, result, result_size)) | 79 FlateDecode(data.input, data.input_size, result, result_size)) |
| 80 << " for case " << i; | 80 << " for case " << i; |
| 81 ASSERT_TRUE(result); | 81 ASSERT_TRUE(result); |
| 82 EXPECT_EQ(std::string((const char*)data.expected, data.expected_size), | 82 EXPECT_EQ(std::string((const char*)data.expected, data.expected_size), |
| 83 std::string((const char*)result, result_size)) | 83 std::string((const char*)result, result_size)) |
| 84 << " for case " << i; | 84 << " for case " << i; |
| 85 FX_Free(result); | 85 FX_Free(result); |
| 86 } | 86 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 108 | 108 |
| 109 TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) { | 109 TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) { |
| 110 // Tests object numbers with a value > 01000000. | 110 // Tests object numbers with a value > 01000000. |
| 111 // Should open successfully. | 111 // Should open successfully. |
| 112 EXPECT_TRUE(OpenDocument("bug_455199.pdf")); | 112 EXPECT_TRUE(OpenDocument("bug_455199.pdf")); |
| 113 FPDF_PAGE page = LoadPage(0); | 113 FPDF_PAGE page = LoadPage(0); |
| 114 FPDF_BITMAP bitmap = RenderPage(page); | 114 FPDF_BITMAP bitmap = RenderPage(page); |
| 115 FPDFBitmap_Destroy(bitmap); | 115 FPDFBitmap_Destroy(bitmap); |
| 116 UnloadPage(page); | 116 UnloadPage(page); |
| 117 } | 117 } |
| OLD | NEW |