Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(636)

Side by Side Diff: fpdfsdk/src/fpdfview_embeddertest.cpp

Issue 1589783004: Merge to XFA: Loose checking for trailer's size field (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | testing/resources/bug_213.pdf » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 5 #include <limits>
6 #include <string> 6 #include <string>
7 7
8 #include "fpdfsdk/src/fpdfview_c_api_test.h" 8 #include "fpdfsdk/src/fpdfview_c_api_test.h"
9 #include "public/fpdfview.h" 9 #include "public/fpdfview.h"
10 #include "testing/embedder_test.h" 10 #include "testing/embedder_test.h"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 197
198 TEST_F(FPDFViewEmbeddertest, Crasher_454695) { 198 TEST_F(FPDFViewEmbeddertest, Crasher_454695) {
199 // Document is damaged and can't be opened. 199 // Document is damaged and can't be opened.
200 EXPECT_FALSE(OpenDocument("bug_454695.pdf")); 200 EXPECT_FALSE(OpenDocument("bug_454695.pdf"));
201 } 201 }
202 202
203 TEST_F(FPDFViewEmbeddertest, Crasher_572871) { 203 TEST_F(FPDFViewEmbeddertest, Crasher_572871) {
204 EXPECT_TRUE(OpenDocument("bug_572871.pdf")); 204 EXPECT_TRUE(OpenDocument("bug_572871.pdf"));
205 } 205 }
206 206
207 // It tests that document can still be loaded even the trailer has no 'Size'
208 // field if other information is right.
209 TEST_F(FPDFViewEmbeddertest, Failed_213) {
210 EXPECT_TRUE(OpenDocument("bug_213.pdf"));
211 }
212
207 // The following tests pass if the document opens without infinite looping. 213 // The following tests pass if the document opens without infinite looping.
208 TEST_F(FPDFViewEmbeddertest, Hang_298) { 214 TEST_F(FPDFViewEmbeddertest, Hang_298) {
209 EXPECT_FALSE(OpenDocument("bug_298.pdf")); 215 EXPECT_FALSE(OpenDocument("bug_298.pdf"));
210 } 216 }
211 217
212 // Test if the document opens without infinite looping. 218 // Test if the document opens without infinite looping.
213 // Previously this test will hang in a loop inside LoadAllCrossRefV4. After 219 // Previously this test will hang in a loop inside LoadAllCrossRefV4. After
214 // the fix, LoadAllCrossRefV4 will return false after detecting a cross 220 // the fix, LoadAllCrossRefV4 will return false after detecting a cross
215 // reference loop. Cross references will be rebuilt successfully. 221 // reference loop. Cross references will be rebuilt successfully.
216 TEST_F(FPDFViewEmbeddertest, CrossRefV4Loop) { 222 TEST_F(FPDFViewEmbeddertest, CrossRefV4Loop) {
217 EXPECT_TRUE(OpenDocument("bug_xrefv4_loop.pdf")); 223 EXPECT_TRUE(OpenDocument("bug_xrefv4_loop.pdf"));
218 } 224 }
219 225
220 // The test should pass when circular references to ParseIndirectObject will not 226 // The test should pass when circular references to ParseIndirectObject will not
221 // cause infinite loop. 227 // cause infinite loop.
222 TEST_F(FPDFViewEmbeddertest, Hang_343) { 228 TEST_F(FPDFViewEmbeddertest, Hang_343) {
223 EXPECT_FALSE(OpenDocument("bug_343.pdf")); 229 EXPECT_FALSE(OpenDocument("bug_343.pdf"));
224 } 230 }
225 231
226 // The test should pass when the absence of 'Contents' field in a signature 232 // The test should pass when the absence of 'Contents' field in a signature
227 // dictionary will not cause an infinite loop in CPDF_SyntaxParser::GetObject(). 233 // dictionary will not cause an infinite loop in CPDF_SyntaxParser::GetObject().
228 TEST_F(FPDFViewEmbeddertest, Hang_344) { 234 TEST_F(FPDFViewEmbeddertest, Hang_344) {
229 EXPECT_FALSE(OpenDocument("bug_344.pdf")); 235 EXPECT_FALSE(OpenDocument("bug_344.pdf"));
230 } 236 }
231 237
232 // The test should pass even when the file has circular references to pages. 238 // The test should pass even when the file has circular references to pages.
233 TEST_F(FPDFViewEmbeddertest, Hang_360) { 239 TEST_F(FPDFViewEmbeddertest, Hang_360) {
234 EXPECT_FALSE(OpenDocument("bug_360.pdf")); 240 EXPECT_FALSE(OpenDocument("bug_360.pdf"));
235 } 241 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp ('k') | testing/resources/bug_213.pdf » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698