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

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

Issue 2543663003: generate GL_INVALID_VALUE for CheckedNumeric invalid operations (Closed)
Patch Set: Created 4 years 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 | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
index 9e0c32178edd900d7a7ea720bb4f424d2f8fc76f..6bb4acfd7b30f0394f1d2a19716b01e9e67bbf33 100644
--- a/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
+++ b/third_party/WebKit/Source/platform/graphics/gpu/WebGLImageConversion.cpp
@@ -2660,7 +2660,11 @@ GLenum WebGLImageConversion::computeImageSizeInBytes(
}
unsigned padding = 0;
- unsigned residual = (checkedValue % params.alignment).ValueOrDie();
+ CheckedNumeric<uint32_t> checkedResidual = checkedValue % params.alignment;
+ if (!checkedResidual.IsValid()) {
+ return GL_INVALID_VALUE;
+ }
+ unsigned residual = checkedResidual.ValueOrDie();
if (residual) {
padding = params.alignment - residual;
checkedValue += padding;
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698