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

Unified Diff: dm/DMSrcSink.cpp

Issue 1061493002: Prevent DM crash in the PDF sink when src width/height are zero. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 929ff0556b453de2a5786595fb107e69fdc4febe..3db7582aa151fd4965a55e7e2354c84c14f836f9 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -361,6 +361,9 @@ static Error draw_skdocument(const Src& src, SkDocument* doc, SkWStream* dst) {
int h = SkTMin(kLetterHeight, height - (y * kLetterHeight));
SkCanvas* canvas =
doc->beginPage(SkIntToScalar(w), SkIntToScalar(h));
+ if (!canvas) {
+ return "SkDocument::beginPage(w,h) returned NULL";
djsollen 2015/04/03 13:35:01 I think it may be better if we could just produce
+ }
canvas->clipRect(letter);
canvas->translate(-letter.width() * x, -letter.height() * y);
Error err = src.draw(canvas);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698