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

Side by Side Diff: experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp

Issue 18112023: pdfviewer: ignore more bad stauff in pdfs (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "SkNativeParsedPDF.h" 1 #include "SkNativeParsedPDF.h"
2 #include "SkPdfNativeTokenizer.h" 2 #include "SkPdfNativeTokenizer.h"
3 #include "SkPdfBasics.h" 3 #include "SkPdfBasics.h"
4 #include "SkPdfObject.h" 4 #include "SkPdfObject.h"
5 5
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <string.h> 7 #include <string.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 10
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 xrefByteOffset = readTrailer(trailerStart, xrefstartKeywordLine, storeCa talog); 96 xrefByteOffset = readTrailer(trailerStart, xrefstartKeywordLine, storeCa talog);
97 storeCatalog = false; 97 storeCatalog = false;
98 } 98 }
99 99
100 // TODO(edisonn): warn/error expect fObjects[fRefCatalogId].fGeneration == f RefCatalogGeneration 100 // TODO(edisonn): warn/error expect fObjects[fRefCatalogId].fGeneration == f RefCatalogGeneration
101 // TODO(edisonn): security, verify that SkPdfCatalogDictionary is indeed usi ng mapper 101 // TODO(edisonn): security, verify that SkPdfCatalogDictionary is indeed usi ng mapper
102 // load catalog 102 // load catalog
103 103
104 if (fRootCatalogRef) { 104 if (fRootCatalogRef) {
105 fRootCatalog = (SkPdfCatalogDictionary*)resolveReference(fRootCatalogRef ); 105 fRootCatalog = (SkPdfCatalogDictionary*)resolveReference(fRootCatalogRef );
106 SkPdfPageTreeNodeDictionary* tree = fRootCatalog->Pages(this); 106 if (fRootCatalog->isDictionary() && fRootCatalog->valid()) {
107 SkPdfPageTreeNodeDictionary* tree = fRootCatalog->Pages(this);
108 if (tree && tree->isDictionary() && tree->valid()) {
109 fillPages(tree);
110 }
111 }
112 }
107 113
108 fillPages(tree); 114 // TODO(edisonn): corrupted pdf, read it from beginning and rebuild (xref, t railer, or just reall all objects)
109 } else { 115 // 0 pages
110 // TODO(edisonn): corrupted pdf, read it from beginning and rebuild (xre f, trailer, or just reall all objects)
111 // 0 pages
112 }
113 116
114 // now actually read all objects if we want, or do it lazyly 117 // now actually read all objects if we want, or do it lazyly
115 // and resolve references?... or not ... 118 // and resolve references?... or not ...
116 } 119 }
117 120
118 // TODO(edisonn): NYI 121 // TODO(edisonn): NYI
119 SkNativeParsedPDF::~SkNativeParsedPDF() { 122 SkNativeParsedPDF::~SkNativeParsedPDF() {
120 delete[] fFileContent; 123 delete[] fFileContent;
121 delete fAllocator; 124 delete fAllocator;
122 } 125 }
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 } else { 409 } else {
407 fObjects[id].fResolvedReference = resolveReference(fObjects[id]. fObj); 410 fObjects[id].fResolvedReference = resolveReference(fObjects[id]. fObj);
408 } 411 }
409 } 412 }
410 413
411 return fObjects[id].fResolvedReference; 414 return fObjects[id].fResolvedReference;
412 } 415 }
413 // TODO(edisonn): fix the mess with const, probably we need to remove it pre tty much everywhere 416 // TODO(edisonn): fix the mess with const, probably we need to remove it pre tty much everywhere
414 return (SkPdfObject*)ref; 417 return (SkPdfObject*)ref;
415 } 418 }
OLDNEW
« no previous file with comments | « no previous file | experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698