pdfviewer: more simple fixed to prevent crashes
Review URL: https://codereview.chromium.org/19625008
git-svn-id: http://skia.googlecode.com/svn/trunk@10294 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
index ac54304..4fb7f88 100644
--- a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
+++ b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp
@@ -189,9 +189,9 @@
// TODO(edisonn): use null allocator, and let it just fail if memory
// needs allocated (but no crash)!
const unsigned char* current =
- nextObject(0, trailerStart, trailerEnd, &trailerKeyword, fAllocator, NULL);
+ nextObject(0, trailerStart, trailerEnd, &trailerKeyword, NULL, NULL);
- if (strlen("trailer") != trailerKeyword.len() &&
+ if (!trailerKeyword.isKeyword() || strlen("trailer") != trailerKeyword.len() ||
strncmp(trailerKeyword.c_str(), "trailer", strlen("trailer")) != 0) {
// TODO(edisonn): report warning, rebuild trailer from objects.
return -1;