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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "platform/graphics/gpu/WebGLImageConversion.h" 5 #include "platform/graphics/gpu/WebGLImageConversion.h"
6 6
7 #include "platform/graphics/ImageObserver.h" 7 #include "platform/graphics/ImageObserver.h"
8 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h" 8 #include "platform/graphics/cpu/arm/WebGLImageConversionNEON.h"
9 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h" 9 #include "platform/graphics/cpu/mips/WebGLImageConversionMSA.h"
10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h" 10 #include "platform/graphics/cpu/x86/WebGLImageConversionSSE.h"
(...skipping 2642 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 CheckedNumeric<uint32_t> tmp = width; 2653 CheckedNumeric<uint32_t> tmp = width;
2654 tmp *= bytesPerGroup; 2654 tmp *= bytesPerGroup;
2655 if (!tmp.IsValid()) 2655 if (!tmp.IsValid())
2656 return GL_INVALID_VALUE; 2656 return GL_INVALID_VALUE;
2657 lastRowSize = tmp.ValueOrDie(); 2657 lastRowSize = tmp.ValueOrDie();
2658 } else { 2658 } else {
2659 lastRowSize = checkedValue.ValueOrDie(); 2659 lastRowSize = checkedValue.ValueOrDie();
2660 } 2660 }
2661 2661
2662 unsigned padding = 0; 2662 unsigned padding = 0;
2663 unsigned residual = (checkedValue % params.alignment).ValueOrDie(); 2663 CheckedNumeric<uint32_t> checkedResidual = checkedValue % params.alignment;
2664 if (!checkedResidual.IsValid()) {
2665 return GL_INVALID_VALUE;
2666 }
2667 unsigned residual = checkedResidual.ValueOrDie();
2664 if (residual) { 2668 if (residual) {
2665 padding = params.alignment - residual; 2669 padding = params.alignment - residual;
2666 checkedValue += padding; 2670 checkedValue += padding;
2667 } 2671 }
2668 if (!checkedValue.IsValid()) 2672 if (!checkedValue.IsValid())
2669 return GL_INVALID_VALUE; 2673 return GL_INVALID_VALUE;
2670 unsigned paddedRowSize = checkedValue.ValueOrDie(); 2674 unsigned paddedRowSize = checkedValue.ValueOrDie();
2671 2675
2672 CheckedNumeric<uint32_t> rows = imageHeight; 2676 CheckedNumeric<uint32_t> rows = imageHeight;
2673 rows *= (depth - 1); 2677 rows *= (depth - 1);
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
3164 pack<WebGLImageConversion::DataFormatRGB565, 3168 pack<WebGLImageConversion::DataFormatRGB565,
3165 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart, 3169 WebGLImageConversion::AlphaDoNothing>(srcRowStart, dstRowStart,
3166 pixelsPerRow); 3170 pixelsPerRow);
3167 } break; 3171 } break;
3168 default: 3172 default:
3169 break; 3173 break;
3170 } 3174 }
3171 } 3175 }
3172 3176
3173 } // namespace blink 3177 } // namespace blink
OLDNEW
« 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