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

Unified Diff: experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp

Issue 19625008: pdfviewer: more simple fixed to prevent crashes (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp
===================================================================
--- experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp (revision 10293)
+++ experimental/PdfViewer/pdfparser/native/SkPdfNativeTokenizer.cpp (working copy)
@@ -125,6 +125,11 @@
// last elem has to be ]
static const unsigned char* readArray(int level, const unsigned char* start, const unsigned char* end, SkPdfObject* array, SkPdfAllocator* allocator, SkNativeParsedPDF* doc) {
+ if (allocator == NULL) {
+ // TODO(edisonn): report/warning error
+ return end;
+ }
+
TRACE_INDENT(level, "Array");
while (start < end) {
// skip white spaces
@@ -208,7 +213,7 @@
break;
case 'f':
- *out = kFF_PdfWhiteSpace;
+ if (hasOut) { *out = kFF_PdfWhiteSpace; }
out++;
in += 2;
break;
@@ -693,6 +698,10 @@
}
static const unsigned char* readDictionary(int level, const unsigned char* start, const unsigned char* end, SkPdfObject* dict, SkPdfAllocator* allocator, SkNativeParsedPDF* doc) {
+ if (allocator == NULL) {
+ // TODO(edisonn): report/warning error
+ return end;
+ }
TRACE_INDENT(level, "Dictionary");
SkPdfObject::makeEmptyDictionary(dict);
« no previous file with comments | « experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698