Index: Source/core/html/canvas/CanvasRenderingContext2D.cpp |
diff --git a/Source/core/html/canvas/CanvasRenderingContext2D.cpp b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
index e40dbf7348b1f7047f1fe6e4004862659f05b517..09596617c6db645c3a226b252b3b503fa1b22e8e 100644 |
--- a/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
+++ b/Source/core/html/canvas/CanvasRenderingContext2D.cpp |
@@ -1918,15 +1918,12 @@ GraphicsContext* CanvasRenderingContext2D::drawingContext() const |
static PassRefPtr<ImageData> createEmptyImageData(const IntSize& size) |
{ |
- Checked<int, RecordOverflow> dataSize = 4; |
- dataSize *= size.width(); |
- dataSize *= size.height(); |
- if (dataSize.hasOverflowed()) |
- return nullptr; |
+ if (RefPtr<ImageData> data = ImageData::create(size)) { |
+ data->data()->zeroFill(); |
+ return data.release(); |
+ } |
- RefPtr<ImageData> data = ImageData::create(size); |
- data->data()->zeroFill(); |
- return data.release(); |
+ return nullptr; |
} |
PassRefPtr<ImageData> CanvasRenderingContext2D::createImageData(PassRefPtr<ImageData> imageData, ExceptionState& exceptionState) const |