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

Unified Diff: ppapi/cpp/image_data.cc

Issue 519873002: Avoid OOB memcpy in chrome_pdf::CopyImage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix underlying math bug. Created 6 years, 4 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
« ppapi/cpp/image_data.h ('K') | « ppapi/cpp/image_data.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/image_data.cc
diff --git a/ppapi/cpp/image_data.cc b/ppapi/cpp/image_data.cc
index d9738964795eb698d8d612a1b2964f1164594415..90b7c97ab814657da61d28b08ee1d549252c62a0 100644
--- a/ppapi/cpp/image_data.cc
+++ b/ppapi/cpp/image_data.cc
@@ -74,6 +74,11 @@ uint32_t* ImageData::GetAddr32(const Point& coord) {
&static_cast<char*>(data())[coord.y() * stride() + coord.x() * 4]);
}
+bool ImageData::Contains(const pp::Rect& rect) const {
+ return rect.width() >= 0 && rect.height() >= 0 &&
+ pp::Rect(size()).Contains(rect);
+}
+
// static
bool ImageData::IsImageDataFormatSupported(PP_ImageDataFormat format) {
if (!has_interface<PPB_ImageData_1_0>())
« ppapi/cpp/image_data.h ('K') | « ppapi/cpp/image_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698