| 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/parser/fpdf_parser_decode.h" | 5 #include "core/fpdfapi/parser/fpdf_parser_decode.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "core/fxcrt/fx_basic.h" | 10 #include "core/fxcrt/fx_basic.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 FX_Free(result); | 85 FX_Free(result); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 TEST_F(FPDFParserDecodeEmbeddertest, Bug_552046) { | 89 TEST_F(FPDFParserDecodeEmbeddertest, Bug_552046) { |
| 90 // Tests specifying multiple image filters for a stream. Should not cause a | 90 // Tests specifying multiple image filters for a stream. Should not cause a |
| 91 // crash when rendered. | 91 // crash when rendered. |
| 92 EXPECT_TRUE(OpenDocument("bug_552046.pdf")); | 92 EXPECT_TRUE(OpenDocument("bug_552046.pdf")); |
| 93 FPDF_PAGE page = LoadPage(0); | 93 FPDF_PAGE page = LoadPage(0); |
| 94 FPDF_BITMAP bitmap = RenderPage(page); | 94 FPDF_BITMAP bitmap = RenderPage(page); |
| 95 CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3"); |
| 95 FPDFBitmap_Destroy(bitmap); | 96 FPDFBitmap_Destroy(bitmap); |
| 96 UnloadPage(page); | 97 UnloadPage(page); |
| 97 } | 98 } |
| 98 | 99 |
| 99 TEST_F(FPDFParserDecodeEmbeddertest, Bug_555784) { | 100 TEST_F(FPDFParserDecodeEmbeddertest, Bug_555784) { |
| 100 // Tests bad input to the run length decoder that caused a heap overflow. | 101 // Tests bad input to the run length decoder that caused a heap overflow. |
| 101 // Should not cause a crash when rendered. | 102 // Should not cause a crash when rendered. |
| 102 EXPECT_TRUE(OpenDocument("bug_555784.pdf")); | 103 EXPECT_TRUE(OpenDocument("bug_555784.pdf")); |
| 103 FPDF_PAGE page = LoadPage(0); | 104 FPDF_PAGE page = LoadPage(0); |
| 104 FPDF_BITMAP bitmap = RenderPage(page); | 105 FPDF_BITMAP bitmap = RenderPage(page); |
| 106 CompareBitmap(bitmap, 612, 792, "1940568c9ba33bac5d0b1ee9558c76b3"); |
| 105 FPDFBitmap_Destroy(bitmap); | 107 FPDFBitmap_Destroy(bitmap); |
| 106 UnloadPage(page); | 108 UnloadPage(page); |
| 107 } | 109 } |
| 108 | 110 |
| 109 TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) { | 111 TEST_F(FPDFParserDecodeEmbeddertest, Bug_455199) { |
| 110 // Tests object numbers with a value > 01000000. | 112 // Tests object numbers with a value > 01000000. |
| 111 // Should open successfully. | 113 // Should open successfully. |
| 112 EXPECT_TRUE(OpenDocument("bug_455199.pdf")); | 114 EXPECT_TRUE(OpenDocument("bug_455199.pdf")); |
| 113 FPDF_PAGE page = LoadPage(0); | 115 FPDF_PAGE page = LoadPage(0); |
| 114 FPDF_BITMAP bitmap = RenderPage(page); | 116 FPDF_BITMAP bitmap = RenderPage(page); |
| 117 #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ |
| 118 // Rendering on Mac is inconsistent, so skip this check. |
| 119 const char* const kExpectedMd5sum = nullptr; |
| 120 #else |
| 121 const char kExpectedMd5sum[] = "6f9f0fd903da177babb24dd50a806a56"; |
| 122 #endif |
| 123 CompareBitmap(bitmap, 200, 200, kExpectedMd5sum); |
| 115 FPDFBitmap_Destroy(bitmap); | 124 FPDFBitmap_Destroy(bitmap); |
| 116 UnloadPage(page); | 125 UnloadPage(page); |
| 117 } | 126 } |
| OLD | NEW |