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

Unified Diff: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h

Issue 1566283003: Upgrade blink side ReadPixels size validation to consider ES3 pack parameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
Index: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h
index fddb53ad5d8b17011526d987cd171f23885b9006..5f17e6266a29c8ecda4cc091207f166dac1de3b0 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h
+++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.h
@@ -115,6 +115,17 @@ public:
HtmlDomNone = 3
};
+ struct PLATFORM_EXPORT PixelStoreParams final {
+ PixelStoreParams();
+
+ GLint alignment;
+ GLint rowLength;
+ GLint imageHeight;
+ GLint skipPixels;
+ GLint skipRows;
+ GLint skipImages;
+ };
+
class PLATFORM_EXPORT ImageExtractor final {
STACK_ALLOCATED();
public:
@@ -152,7 +163,12 @@ public:
// return the suggested GL error indicating the cause of the failure:
// INVALID_VALUE if width/height/depth is negative or overflow happens.
// INVALID_ENUM if format/type is illegal.
- static GLenum computeImageSizeInBytes(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth, GLint alignment, unsigned* imageSizeInBytes, unsigned* paddingInBytes);
+ // Note that imageSizeBytes does not include skipSizeInBytes, but it is
+ // guaranteed if NO_ERROR is returned, adding the two sizes won't cause
+ // overflow.
+ // |paddingInBytes| and |skipSizeInBytes| are optional and can be null, but
+ // the overflow validation is still performed.
+ static GLenum computeImageSizeInBytes(GLenum format, GLenum type, GLsizei width, GLsizei height, GLsizei depth, const PixelStoreParams&, unsigned* imageSizeInBytes, unsigned* paddingInBytes, unsigned* skipSizeInBytes);
// Check if the format is one of the formats from the ImageData or DOM elements.
// The formats from ImageData is always RGBA8.

Powered by Google App Engine
This is Rietveld 408576698