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

Unified Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 6384009: Avoid null-pointer dereference for PPAPI Instance BindGraphics.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 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: webkit/plugins/ppapi/ppapi_plugin_instance.cc
===================================================================
--- webkit/plugins/ppapi/ppapi_plugin_instance.cc (revision 72340)
+++ webkit/plugins/ppapi/ppapi_plugin_instance.cc (working copy)
@@ -460,16 +460,18 @@
// repaints.
const SkBitmap* old_backing_bitmap =
bound_graphics_2d()->image_data()->GetMappedBitmap();
David Springer 2011/01/24 20:19:29 Is there any chance that these accessors could ret
- SkRect old_size = SkRect::MakeWH(
- SkScalar(static_cast<float>(old_backing_bitmap->width())),
- SkScalar(static_cast<float>(old_backing_bitmap->height())));
+ if (old_backing_bitmap != NULL) {
brettw 2011/01/24 21:00:07 Instead of checking to see if there's no mapped bi
+ SkRect old_size = SkRect::MakeWH(
+ SkScalar(static_cast<float>(old_backing_bitmap->width())),
+ SkScalar(static_cast<float>(old_backing_bitmap->height())));
- SkCanvas canvas(*graphics_2d->image_data()->GetMappedBitmap());
- canvas.drawBitmap(*old_backing_bitmap, 0, 0);
+ SkCanvas canvas(*graphics_2d->image_data()->GetMappedBitmap());
+ canvas.drawBitmap(*old_backing_bitmap, 0, 0);
- // Fill in any extra space with white.
- canvas.clipRect(old_size, SkRegion::kDifference_Op);
- canvas.drawARGB(255, 255, 255, 255);
+ // Fill in any extra space with white.
+ canvas.clipRect(old_size, SkRegion::kDifference_Op);
+ canvas.drawARGB(255, 255, 255, 255);
+ }
}
bound_graphics_ = graphics_2d;
« 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