Commit bbad71f1 authored by zandobersek@gmail.com's avatar zandobersek@gmail.com

Remove CheckedInt, use Checked<T, RecordOverflow> instead

https://bugs.webkit.org/show_bug.cgi?id=119022

Reviewed by Oliver Hunt.

Following the cleanup in r153062, the CheckedInt uses are replaced with
using the Checked<T, RecordOverflow> class. The CheckedInt header is not
used anywhere anymore and is thus removed.

* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:
* html/canvas/CheckedInt.h: Removed.
* html/canvas/DataView.cpp:
(WebCore::DataView::create):
* html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::associateBufferSubDataImpl):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::drawArrays):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153095 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 5d5175c6
2013-07-24 Zan Dobersek <zdobersek@igalia.com>
Remove CheckedInt, use Checked<T, RecordOverflow> instead
https://bugs.webkit.org/show_bug.cgi?id=119022
Reviewed by Oliver Hunt.
Following the cleanup in r153062, the CheckedInt uses are replaced with
using the Checked<T, RecordOverflow> class. The CheckedInt header is not
used anywhere anymore and is thus removed.
* GNUmakefile.list.am:
* WebCore.xcodeproj/project.pbxproj:
* html/canvas/CheckedInt.h: Removed.
* html/canvas/DataView.cpp:
(WebCore::DataView::create):
* html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::associateBufferSubDataImpl):
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::drawArrays):
2013-07-24 Andreas Kling <akling@apple.com>
RenderMenuList computes the width of its longest option twice.
......@@ -3330,7 +3330,6 @@ webcore_sources += \
Source/WebCore/html/canvas/CanvasRenderingContext.h \
Source/WebCore/html/canvas/CanvasStyle.cpp \
Source/WebCore/html/canvas/CanvasStyle.h \
Source/WebCore/html/canvas/CheckedInt.h \
Source/WebCore/html/canvas/DataView.cpp \
Source/WebCore/html/canvas/DataView.h \
Source/WebCore/html/canvas/DOMPath.h \
......
......@@ -3313,7 +3313,6 @@
9FA37EFB1172FDA600C4CD55 /* JSScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */; };
9FA37EFC1172FDA600C4CD55 /* JSScriptProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */; };
9FA37EFD1172FDA600C4CD55 /* JSScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */; };
A00B721A11DE6428008AB9FF /* CheckedInt.h in Headers */ = {isa = PBXBuildFile; fileRef = A00B721911DE6427008AB9FF /* CheckedInt.h */; };
A024575116CEAA27000E5671 /* EXTDrawBuffers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A024574E16CEAA27000E5671 /* EXTDrawBuffers.cpp */; };
A024575216CEAA27000E5671 /* EXTDrawBuffers.h in Headers */ = {isa = PBXBuildFile; fileRef = A024574F16CEAA27000E5671 /* EXTDrawBuffers.h */; };
A07D3355152B630E001B6393 /* JSWebGLShaderPrecisionFormat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A07D3353152B630E001B6393 /* JSWebGLShaderPrecisionFormat.cpp */; };
......@@ -9783,7 +9782,6 @@
9FA37EF71172FD9300C4CD55 /* JSScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptProfile.h; sourceTree = "<group>"; };
9FA37EF81172FD9300C4CD55 /* JSScriptProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSScriptProfileNode.cpp; sourceTree = "<group>"; };
9FA37EF91172FD9300C4CD55 /* JSScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSScriptProfileNode.h; sourceTree = "<group>"; };
A00B721911DE6427008AB9FF /* CheckedInt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CheckedInt.h; path = canvas/CheckedInt.h; sourceTree = "<group>"; };
A024574E16CEAA27000E5671 /* EXTDrawBuffers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EXTDrawBuffers.cpp; path = canvas/EXTDrawBuffers.cpp; sourceTree = "<group>"; };
A024574F16CEAA27000E5671 /* EXTDrawBuffers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EXTDrawBuffers.h; path = canvas/EXTDrawBuffers.h; sourceTree = "<group>"; };
A024575016CEAA27000E5671 /* EXTDrawBuffers.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = EXTDrawBuffers.idl; path = canvas/EXTDrawBuffers.idl; sourceTree = "<group>"; };
......@@ -14058,7 +14056,6 @@
49484FBE102CF23C00187DD3 /* CanvasRenderingContext2D.idl */,
49484FBF102CF23C00187DD3 /* CanvasStyle.cpp */,
49484FC0102CF23C00187DD3 /* CanvasStyle.h */,
A00B721911DE6427008AB9FF /* CheckedInt.h */,
2E97CCE712939CB800C5C8FF /* DataView.cpp */,
2E97CCE812939CB800C5C8FF /* DataView.h */,
2E97CCE912939CB800C5C8FF /* DataView.idl */,
......@@ -21150,7 +21147,6 @@
97B8FFD116AE7F960038388D /* CharacterReferenceParserInlines.h in Headers */,
B2C3DA2A0D006C1D00EF6F26 /* CharsetData.h in Headers */,
F55B3DB21251F12D003EF269 /* CheckboxInputType.h in Headers */,
A00B721A11DE6428008AB9FF /* CheckedInt.h in Headers */,
93F925430F7EF5B8007E37C9 /* CheckedRadioButtons.h in Headers */,
D619A308144E00BE004BC302 /* ChildListMutationScope.h in Headers */,
A81872200977D3C0005826D9 /* ChildNodeList.h in Headers */,
This diff is collapsed.
......@@ -26,7 +26,6 @@
#include "config.h"
#include "DataView.h"
#include "CheckedInt.h"
#include "ExceptionCode.h"
namespace {
......@@ -53,10 +52,10 @@ PassRefPtr<DataView> DataView::create(PassRefPtr<ArrayBuffer> buffer, unsigned b
{
if (byteOffset > buffer->byteLength())
return 0;
CheckedInt<uint32_t> checkedOffset(byteOffset);
CheckedInt<uint32_t> checkedLength(byteLength);
CheckedInt<uint32_t> checkedMax = checkedOffset + checkedLength;
if (!checkedMax.isValid() || checkedMax.value() > buffer->byteLength())
Checked<uint32_t, RecordOverflow> checkedOffset(byteOffset);
Checked<uint32_t, RecordOverflow> checkedLength(byteLength);
Checked<uint32_t, RecordOverflow> checkedMax = checkedOffset + checkedLength;
if (checkedMax.hasOverflowed() || checkedMax.unsafeGet() > buffer->byteLength())
return 0;
return adoptRef(new DataView(buffer, byteOffset, byteLength));
}
......
......@@ -29,7 +29,6 @@
#include "WebGLBuffer.h"
#include "CheckedInt.h"
#include "WebGLContextGroup.h"
#include "WebGLRenderingContext.h"
......@@ -117,10 +116,10 @@ bool WebGLBuffer::associateBufferSubDataImpl(GC3Dintptr offset, const void* data
return false;
if (byteLength) {
CheckedInt<GC3Dintptr> checkedBufferOffset(offset);
CheckedInt<GC3Dsizeiptr> checkedDataLength(byteLength);
CheckedInt<GC3Dintptr> checkedBufferMax = checkedBufferOffset + checkedDataLength;
if (!checkedBufferMax.isValid() || offset > m_byteLength || checkedBufferMax.value() > m_byteLength)
Checked<GC3Dintptr, RecordOverflow> checkedBufferOffset(offset);
Checked<GC3Dsizeiptr, RecordOverflow> checkedDataLength(byteLength);
Checked<GC3Dintptr, RecordOverflow> checkedBufferMax = checkedBufferOffset + checkedDataLength;
if (checkedBufferMax.hasOverflowed() || offset > m_byteLength || checkedBufferMax.unsafeGet() > m_byteLength)
return false;
}
......
......@@ -30,7 +30,6 @@
#include "WebGLRenderingContext.h"
#include "CachedImage.h"
#include "CheckedInt.h"
#include "DOMWindow.h"
#include "EXTDrawBuffers.h"
#include "EXTTextureFilterAnisotropic.h"
......@@ -1954,10 +1953,10 @@ void WebGLRenderingContext::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei c
if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
// Ensure we have a valid rendering state
CheckedInt<GC3Dint> checkedFirst(first);
CheckedInt<GC3Dint> checkedCount(count);
CheckedInt<GC3Dint> checkedSum = checkedFirst + checkedCount;
if (!checkedSum.isValid() || !validateRenderingState(checkedSum.value())) {
Checked<GC3Dint, RecordOverflow> checkedFirst(first);
Checked<GC3Dint, RecordOverflow> checkedCount(count);
Checked<GC3Dint, RecordOverflow> checkedSum = checkedFirst + checkedCount;
if (checkedSum.hasOverflowed() || !validateRenderingState(checkedSum.unsafeGet())) {
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "drawArrays", "attempt to access out of bounds arrays");
return;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment