Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (278350 => 278351)
--- trunk/Source/_javascript_Core/ChangeLog 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-06-02 15:42:27 UTC (rev 278351)
@@ -1,3 +1,34 @@
+2021-06-02 Chris Dumez <cdu...@apple.com>
+
+ Use Checked aliases instead of Checked<T, RecordOverflow>
+ https://bugs.webkit.org/show_bug.cgi?id=226535
+
+ Reviewed by Keith Miller.
+
+ * dfg/DFGAbstractInterpreterInlines.h:
+ (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
+ * ftl/FTLOperations.cpp:
+ (JSC::FTL::JSC_DEFINE_JIT_OPERATION):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::appendMemcpy):
+ (JSC::JSArray::unshiftCountWithAnyIndexingType):
+ * runtime/JSStringJoiner.cpp:
+ (JSC::JSStringJoiner::joinedLength const):
+ * runtime/JSStringJoiner.h:
+ * runtime/StringPrototype.cpp:
+ (JSC::jsSpliceSubstringsWithSeparators):
+ * wasm/WasmFormat.cpp:
+ (JSC::Wasm::Segment::create):
+ * wasm/WasmOperations.cpp:
+ (JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
+ * wasm/WasmTable.cpp:
+ (JSC::Wasm::Table::grow):
+ * yarr/YarrInterpreter.cpp:
+ (JSC::Yarr::ByteCompiler::emitDisjunction):
+ * yarr/YarrParser.h:
+ (JSC::Yarr::Parser::consumeNumber):
+ * yarr/YarrPattern.cpp:
+
2021-06-01 Darin Adler <da...@apple.com>
Remove <wtf/Optional.h>
Modified: trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h (278350 => 278351)
--- trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/dfg/DFGAbstractInterpreterInlines.h 2021-06-02 15:42:27 UTC (rev 278351)
@@ -2551,7 +2551,7 @@
// that's the conservative thing to do. Otherwise we'd need to write more code to mark such
// paths as unreachable, or to return undefined. We could implement that eventually.
- Checked<unsigned, RecordOverflow> argumentIndexChecked = index.asUInt32();
+ CheckedUint32 argumentIndexChecked = index.asUInt32();
argumentIndexChecked += node->numberOfArgumentsToSkip();
unsigned argumentIndex;
if (argumentIndexChecked.safeGet(argumentIndex) != CheckedState::DidOverflow) {
Modified: trunk/Source/_javascript_Core/ftl/FTLOperations.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/ftl/FTLOperations.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/ftl/FTLOperations.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -612,7 +612,7 @@
JSGlobalObject* globalObject = codeBlock->globalObject();
Structure* structure = globalObject->arrayStructureForIndexingTypeDuringAllocation(ArrayWithContiguous);
- Checked<unsigned, RecordOverflow> checkedArraySize = 0;
+ CheckedUint32 checkedArraySize = 0;
unsigned numProperties = 0;
for (unsigned i = materialization->properties().size(); i--;) {
const ExitPropertyValue& property = materialization->properties()[i];
Modified: trunk/Source/_javascript_Core/runtime/JSArray.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/runtime/JSArray.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/runtime/JSArray.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -504,7 +504,7 @@
return false;
unsigned otherLength = otherArray->length();
- Checked<unsigned, RecordOverflow> checkedNewLength = startIndex;
+ CheckedUint32 checkedNewLength = startIndex;
checkedNewLength += otherLength;
unsigned newLength;
@@ -1041,7 +1041,7 @@
if (oldLength - startIndex >= MIN_SPARSE_ARRAY_INDEX)
RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(globalObject, startIndex, count, ensureArrayStorage(vm)));
- Checked<unsigned, RecordOverflow> checkedLength(oldLength);
+ CheckedUint32 checkedLength(oldLength);
checkedLength += count;
unsigned newLength;
if (CheckedState::DidOverflow == checkedLength.safeGet(newLength)) {
@@ -1090,7 +1090,7 @@
if (oldLength - startIndex >= MIN_SPARSE_ARRAY_INDEX)
RELEASE_AND_RETURN(scope, unshiftCountWithArrayStorage(globalObject, startIndex, count, ensureArrayStorage(vm)));
- Checked<unsigned, RecordOverflow> checkedLength(oldLength);
+ CheckedUint32 checkedLength(oldLength);
checkedLength += count;
unsigned newLength;
if (CheckedState::DidOverflow == checkedLength.safeGet(newLength)) {
Modified: trunk/Source/_javascript_Core/runtime/JSStringJoiner.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/runtime/JSStringJoiner.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/runtime/JSStringJoiner.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -88,9 +88,9 @@
if (!numberOfStrings)
return 0;
- Checked<int32_t, RecordOverflow> separatorLength = m_separator.length();
- Checked<int32_t, RecordOverflow> totalSeparatorsLength = separatorLength * (numberOfStrings - 1);
- Checked<int32_t, RecordOverflow> totalLength = totalSeparatorsLength + m_accumulatedStringsLength;
+ CheckedInt32 separatorLength = m_separator.length();
+ CheckedInt32 totalSeparatorsLength = separatorLength * (numberOfStrings - 1);
+ CheckedInt32 totalLength = totalSeparatorsLength + m_accumulatedStringsLength;
int32_t result;
if (totalLength.safeGet(result) == CheckedState::DidOverflow) {
Modified: trunk/Source/_javascript_Core/runtime/JSStringJoiner.h (278350 => 278351)
--- trunk/Source/_javascript_Core/runtime/JSStringJoiner.h 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/runtime/JSStringJoiner.h 2021-06-02 15:42:27 UTC (rev 278351)
@@ -53,7 +53,7 @@
LChar m_singleCharacterSeparator;
StringView m_separator;
Vector<StringViewWithUnderlyingString> m_strings;
- Checked<unsigned, RecordOverflow> m_accumulatedStringsLength;
+ CheckedUint32 m_accumulatedStringsLength;
bool m_isAll8Bit { true };
};
Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -378,7 +378,7 @@
RELEASE_AND_RETURN(scope, jsString(globalObject, leftPart, separators[0], rightPart));
}
- Checked<int, RecordOverflow> totalLength = 0;
+ CheckedInt32 totalLength = 0;
bool allSeparators8Bit = true;
for (int i = 0; i < rangeCount; i++)
totalLength += substringRanges[i].length;
Modified: trunk/Source/_javascript_Core/wasm/WasmFormat.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/wasm/WasmFormat.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/wasm/WasmFormat.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -36,7 +36,7 @@
Segment::Ptr Segment::create(std::optional<I32InitExpr> offset, uint32_t sizeInBytes, Kind kind)
{
- Checked<uint32_t, RecordOverflow> totalBytesChecked = sizeInBytes;
+ CheckedUint32 totalBytesChecked = sizeInBytes;
totalBytesChecked += sizeof(Segment);
uint32_t totalBytes;
if (totalBytesChecked.safeGet(totalBytes) == CheckedState::DidOverflow)
Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -788,7 +788,7 @@
if ((srcOffset < 0) || (dstOffset < 0) || (length < 0))
return false;
- Checked<uint32_t, RecordOverflow> lastDstElementIndexChecked = static_cast<uint32_t>(dstOffset);
+ CheckedUint32 lastDstElementIndexChecked = static_cast<uint32_t>(dstOffset);
lastDstElementIndexChecked += static_cast<uint32_t>(length);
uint32_t lastDstElementIndex;
@@ -798,7 +798,7 @@
if (lastDstElementIndex > dstTable->length())
return false;
- Checked<uint32_t, RecordOverflow> lastSrcElementIndexChecked = static_cast<uint32_t>(srcOffset);
+ CheckedUint32 lastSrcElementIndexChecked = static_cast<uint32_t>(srcOffset);
lastSrcElementIndexChecked += static_cast<uint32_t>(length);
uint32_t lastSrcElementIndex;
Modified: trunk/Source/_javascript_Core/wasm/WasmTable.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/wasm/WasmTable.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/wasm/WasmTable.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -87,8 +87,7 @@
Locker locker { m_owner->cellLock() };
- using Checked = Checked<uint32_t, RecordOverflow>;
- Checked newLengthChecked = length();
+ CheckedUint32 newLengthChecked = length();
newLengthChecked += delta;
uint32_t newLength;
if (newLengthChecked.safeGet(newLength) == CheckedState::DidOverflow)
@@ -101,7 +100,7 @@
auto checkedGrow = [&] (auto& container, auto initializer) {
if (newLengthChecked > allocatedLength(m_length)) {
- Checked reallocSizeChecked = allocatedLength(newLengthChecked);
+ CheckedUint32 reallocSizeChecked = allocatedLength(newLengthChecked);
reallocSizeChecked *= sizeof(*container.get());
uint32_t reallocSize;
if (reallocSizeChecked.safeGet(reallocSize) == CheckedState::DidOverflow)
Modified: trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/yarr/YarrInterpreter.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -2059,7 +2059,7 @@
m_currentAlternativeIndex = newAlternativeIndex;
}
- std::optional<ErrorCode> WARN_UNUSED_RETURN emitDisjunction(PatternDisjunction* disjunction, Checked<unsigned, RecordOverflow> inputCountAlreadyChecked, unsigned parenthesesInputCountAlreadyChecked)
+ std::optional<ErrorCode> WARN_UNUSED_RETURN emitDisjunction(PatternDisjunction* disjunction, CheckedUint32 inputCountAlreadyChecked, unsigned parenthesesInputCountAlreadyChecked)
{
if (UNLIKELY(!isSafeToRecurse()))
return ErrorCode::TooManyDisjunctions;
Modified: trunk/Source/_javascript_Core/yarr/YarrParser.h (278350 => 278351)
--- trunk/Source/_javascript_Core/yarr/YarrParser.h 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/yarr/YarrParser.h 2021-06-02 15:42:27 UTC (rev 278351)
@@ -1079,7 +1079,7 @@
unsigned consumeNumber()
{
- Checked<unsigned, RecordOverflow> n = consumeDigit();
+ CheckedUint32 n = consumeDigit();
while (peekIsDigit())
n = n * 10 + consumeDigit();
return n.hasOverflowed() ? quantifyInfinite : n.value();
Modified: trunk/Source/_javascript_Core/yarr/YarrPattern.cpp (278350 => 278351)
--- trunk/Source/_javascript_Core/yarr/YarrPattern.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/_javascript_Core/yarr/YarrPattern.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -791,7 +791,7 @@
ErrorCode error = ErrorCode::NoError;
alternative->m_hasFixedSize = true;
- Checked<unsigned, RecordOverflow> currentInputPosition = initialInputPosition;
+ CheckedUint32 currentInputPosition = initialInputPosition;
for (unsigned i = 0; i < alternative->m_terms.size(); ++i) {
PatternTerm& term = alternative->m_terms[i];
@@ -820,7 +820,7 @@
currentCallFrameSize += YarrStackSpaceForBackTrackInfoPatternCharacter;
alternative->m_hasFixedSize = false;
} else if (m_pattern.unicode()) {
- Checked<unsigned, RecordOverflow> tempCount = term.quantityMaxCount;
+ CheckedUint32 tempCount = term.quantityMaxCount;
tempCount *= U16_LENGTH(term.patternCharacter);
if (tempCount.hasOverflowed())
return ErrorCode::OffsetTooLarge;
@@ -839,7 +839,7 @@
term.frameLocation = currentCallFrameSize;
currentCallFrameSize += YarrStackSpaceForBackTrackInfoCharacterClass;
if (term.characterClass->hasOneCharacterSize() && !term.invert()) {
- Checked<unsigned, RecordOverflow> tempCount = term.quantityMaxCount;
+ CheckedUint32 tempCount = term.quantityMaxCount;
tempCount *= term.characterClass->hasNonBMPCharacters() ? 2 : 1;
if (tempCount.hasOverflowed())
return ErrorCode::OffsetTooLarge;
Modified: trunk/Source/WTF/ChangeLog (278350 => 278351)
--- trunk/Source/WTF/ChangeLog 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WTF/ChangeLog 2021-06-02 15:42:27 UTC (rev 278351)
@@ -1,3 +1,19 @@
+2021-06-02 Chris Dumez <cdu...@apple.com>
+
+ Use Checked aliases instead of Checked<T, RecordOverflow>
+ https://bugs.webkit.org/show_bug.cgi?id=226535
+
+ Reviewed by Keith Miller.
+
+ * wtf/URLHelpers.cpp:
+ (WTF::URLHelpers::userVisibleURL):
+ * wtf/URLParser.cpp:
+ (WTF::URLParser::parseIPv4Piece):
+ * wtf/cocoa/NSURLExtras.mm:
+ (WTF::dataWithUserTypedString):
+ * wtf/glib/SocketConnection.cpp:
+ (WTF::SocketConnection::sendMessage):
+
2021-05-23 Ryosuke Niwa <rn...@webkit.org>
Add CheckedPtr
Modified: trunk/Source/WTF/wtf/URLHelpers.cpp (278350 => 278351)
--- trunk/Source/WTF/wtf/URLHelpers.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WTF/wtf/URLHelpers.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -830,7 +830,7 @@
bool mayNeedHostNameDecoding = false;
- Checked<int, RecordOverflow> bufferLength = length;
+ CheckedInt32 bufferLength = length;
bufferLength = bufferLength * 3 + 1; // The buffer should be large enough to %-escape every character.
if (bufferLength.hasOverflowed())
return { };
Modified: trunk/Source/WTF/wtf/URLParser.cpp (278350 => 278351)
--- trunk/Source/WTF/wtf/URLParser.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WTF/wtf/URLParser.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -2154,7 +2154,7 @@
Hex,
};
State state = State::UnknownBase;
- Checked<uint32_t, RecordOverflow> value = 0;
+ CheckedUint32 value = 0;
if (!iterator.atEnd() && *iterator == '.')
return makeUnexpected(IPv4PieceParsingError::Failure);
while (!iterator.atEnd()) {
Modified: trunk/Source/WTF/wtf/cocoa/NSURLExtras.mm (278350 => 278351)
--- trunk/Source/WTF/wtf/cocoa/NSURLExtras.mm 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WTF/wtf/cocoa/NSURLExtras.mm 2021-06-02 15:42:27 UTC (rev 278351)
@@ -187,7 +187,7 @@
if (!inLength)
return nil;
- Checked<int, RecordOverflow> mallocLength = inLength;
+ CheckedInt32 mallocLength = inLength;
mallocLength *= 3; // large enough to %-escape every character
if (mallocLength.hasOverflowed())
return nil;
Modified: trunk/Source/WTF/wtf/glib/SocketConnection.cpp (278350 => 278351)
--- trunk/Source/WTF/wtf/glib/SocketConnection.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WTF/wtf/glib/SocketConnection.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -185,7 +185,7 @@
g_warning("Trying to send message with invalid too long name");
return;
}
- Checked<uint32_t, RecordOverflow> bodySize = messageNameLength + parametersSize;
+ CheckedUint32 bodySize = messageNameLength + parametersSize;
if (UNLIKELY(bodySize.hasOverflowed())) {
g_warning("Trying to send message '%s' with invalid too long body", messageName);
return;
Modified: trunk/Source/WebCore/ChangeLog (278350 => 278351)
--- trunk/Source/WebCore/ChangeLog 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/ChangeLog 2021-06-02 15:42:27 UTC (rev 278351)
@@ -1,3 +1,34 @@
+2021-06-02 Chris Dumez <cdu...@apple.com>
+
+ Use Checked aliases instead of Checked<T, RecordOverflow>
+ https://bugs.webkit.org/show_bug.cgi?id=226535
+
+ Reviewed by Keith Miller.
+
+ * html/ImageData.cpp:
+ (WebCore::computeDataSize):
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::validateTexFuncData):
+ (WebCore::WebGLRenderingContextBase::validateCompressedTexFuncData):
+ * platform/graphics/GraphicsContextGL.cpp:
+ (WebCore::GraphicsContextGL::computeImageSizeInBytes):
+ * platform/graphics/IntRect.cpp:
+ (WebCore::IntRect::isValid const):
+ * platform/graphics/PixelBuffer.cpp:
+ (WebCore::PixelBuffer::computeBufferSize):
+ * platform/graphics/PixelBuffer.h:
+ * platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp:
+ (WebCore::ISOFairPlayStreamingKeyRequestInfoBox::parse):
+ * platform/graphics/ca/GraphicsLayerCA.cpp:
+ (WebCore::GraphicsLayerCA::updateBackdropFilters):
+ * platform/graphics/cg/ImageBufferCGBitmapBackend.cpp:
+ (WebCore::ImageBufferCGBitmapBackend::calculateSafeBackendSize):
+ * platform/graphics/win/Direct2DUtilities.cpp:
+ (WebCore::Direct2D::createDirect2DImageSurfaceWithData):
+ * platform/graphics/win/ImageBufferDirect2DBackend.cpp:
+ (WebCore::ImageBufferDirect2DBackend::copyNativeImage const):
+ (WebCore::ImageBufferDirect2DBackend::compatibleBitmap):
+
2021-06-02 Martin Robinson <mrobin...@igalia.com>
[css-scroll-snap] Scroll snap is broken with non-horizontal writing modes
Modified: trunk/Source/WebCore/html/ImageData.cpp (278350 => 278351)
--- trunk/Source/WebCore/html/ImageData.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/html/ImageData.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -35,9 +35,9 @@
namespace WebCore {
-static Checked<unsigned, RecordOverflow> computeDataSize(const IntSize& size)
+static CheckedUint32 computeDataSize(const IntSize& size)
{
- Checked<unsigned, RecordOverflow> checkedDataSize = 4;
+ CheckedUint32 checkedDataSize = 4;
checkedDataSize *= static_cast<unsigned>(size.width());
checkedDataSize *= static_cast<unsigned>(size.height());
return checkedDataSize;
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (278350 => 278351)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -5323,7 +5323,7 @@
synthesizeGLError(error, functionName, "invalid texture dimensions");
return false;
}
- Checked<uint32_t, RecordOverflow> total = srcOffset;
+ CheckedUint32 total = srcOffset;
total *= JSC::elementSize(pixels->getType());
total += totalBytesRequired;
total += skipBytes;
@@ -6812,7 +6812,7 @@
case ExtensionsGL::COMPRESSED_SRGB8_ETC2:
case ExtensionsGL::COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
case ExtensionsGL::COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: {
- Checked<unsigned, RecordOverflow> checkedBytesRequired = (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize;
+ CheckedUint32 checkedBytesRequired = (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize;
checkedBytesRequired *= (height + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize;
checkedBytesRequired *= 8;
if (checkedBytesRequired.hasOverflowed()) {
@@ -6826,7 +6826,7 @@
case ExtensionsGL::COMPRESSED_SIGNED_RG11_EAC:
case ExtensionsGL::COMPRESSED_RGBA8_ETC2_EAC:
case ExtensionsGL::COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: {
- Checked<unsigned, RecordOverflow> checkedBytesRequired = (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize;
+ CheckedUint32 checkedBytesRequired = (width + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize;
checkedBytesRequired *= (height + kEACAndETC2BlockSize - 1) / kEACAndETC2BlockSize;
checkedBytesRequired *= 16;
if (checkedBytesRequired.hasOverflowed()) {
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContextGL.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -670,7 +670,7 @@
if (!computeFormatAndTypeParameters(format, type, &componentsPerPixel, &bytesPerComponent))
return GraphicsContextGL::INVALID_ENUM;
unsigned bytesPerGroup = bytesPerComponent * componentsPerPixel;
- Checked<uint32_t, RecordOverflow> checkedValue = static_cast<uint32_t>(rowLength);
+ CheckedUint32 checkedValue = static_cast<uint32_t>(rowLength);
checkedValue *= bytesPerGroup;
if (checkedValue.hasOverflowed())
return GraphicsContextGL::INVALID_VALUE;
@@ -677,7 +677,7 @@
unsigned lastRowSize;
if (params.rowLength > 0 && params.rowLength != width) {
- Checked<uint32_t, RecordOverflow> tmp = width;
+ CheckedUint32 tmp = width;
tmp *= bytesPerGroup;
if (tmp.hasOverflowed())
return GraphicsContextGL::INVALID_VALUE;
@@ -695,7 +695,7 @@
return GraphicsContextGL::INVALID_VALUE;
unsigned paddedRowSize = checkedValue;
- Checked<uint32_t, RecordOverflow> rows = imageHeight;
+ CheckedUint32 rows = imageHeight;
rows *= (depth - 1);
// Last image is not affected by IMAGE_HEIGHT parameter.
rows += height;
@@ -710,9 +710,9 @@
if (paddingInBytes)
*paddingInBytes = padding;
- Checked<uint32_t, RecordOverflow> skipSize = 0;
+ CheckedUint32 skipSize = 0;
if (params.skipImages > 0) {
- Checked<uint32_t, RecordOverflow> tmp = paddedRowSize;
+ CheckedUint32 tmp = paddedRowSize;
tmp *= imageHeight;
tmp *= params.skipImages;
if (tmp.hasOverflowed())
@@ -720,7 +720,7 @@
skipSize += tmp;
}
if (params.skipRows > 0) {
- Checked<uint32_t, RecordOverflow> tmp = paddedRowSize;
+ CheckedUint32 tmp = paddedRowSize;
tmp *= params.skipRows;
if (tmp.hasOverflowed())
return GraphicsContextGL::INVALID_VALUE;
@@ -727,7 +727,7 @@
skipSize += tmp;
}
if (params.skipPixels > 0) {
- Checked<uint32_t, RecordOverflow> tmp = bytesPerGroup;
+ CheckedUint32 tmp = bytesPerGroup;
tmp *= params.skipPixels;
if (tmp.hasOverflowed())
return GraphicsContextGL::INVALID_VALUE;
Modified: trunk/Source/WebCore/platform/graphics/IntRect.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/IntRect.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/IntRect.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -149,7 +149,7 @@
bool IntRect::isValid() const
{
- Checked<int, RecordOverflow> max = m_location.x();
+ CheckedInt32 max = m_location.x();
max += m_size.width();
if (max.hasOverflowed())
return false;
Modified: trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/PixelBuffer.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -47,7 +47,7 @@
return false;
}
-Checked<unsigned, RecordOverflow> PixelBuffer::computeBufferSize(const PixelBufferFormat& format, const IntSize& size)
+CheckedUint32 PixelBuffer::computeBufferSize(const PixelBufferFormat& format, const IntSize& size)
{
ASSERT_UNUSED(format, supportedPixelFormat(format.pixelFormat));
Modified: trunk/Source/WebCore/platform/graphics/PixelBuffer.h (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/PixelBuffer.h 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/PixelBuffer.h 2021-06-02 15:42:27 UTC (rev 278351)
@@ -67,7 +67,7 @@
private:
WEBCORE_EXPORT static std::optional<PixelBuffer> tryCreateForDecoding(const PixelBufferFormat&, const IntSize&, unsigned dataByteLength);
- WEBCORE_EXPORT static Checked<unsigned, RecordOverflow> computeBufferSize(const PixelBufferFormat&, const IntSize&);
+ WEBCORE_EXPORT static CheckedUint32 computeBufferSize(const PixelBufferFormat&, const IntSize&);
PixelBufferFormat m_format;
IntSize m_size;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/ISOFairPlayStreamingPsshBox.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -50,7 +50,7 @@
if (!ISOBox::parse(view, localOffset))
return false;
- Checked<uint64_t, RecordOverflow> remaining = m_size;
+ CheckedUint64 remaining = m_size;
remaining -= (localOffset - offset);
if (remaining.hasOverflowed())
return false;
Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -2340,17 +2340,14 @@
void GraphicsLayerCA::updateBackdropFilters(CommitState& commitState)
{
- using CheckedUnsigned = Checked<unsigned, RecordOverflow>;
-
bool canHaveBackdropFilters = needsBackdrop();
-
if (canHaveBackdropFilters) {
canHaveBackdropFilters = false;
IntRect backdropFilterRect = enclosingIntRect(m_backdropFiltersRect.rect());
if (backdropFilterRect.width() > 0 && backdropFilterRect.height() > 0) {
- CheckedUnsigned backdropFilterArea = CheckedUnsigned(backdropFilterRect.width()) * CheckedUnsigned(backdropFilterRect.height());
+ CheckedUint32 backdropFilterArea = CheckedUint32(backdropFilterRect.width()) * CheckedUint32(backdropFilterRect.height());
if (!backdropFilterArea.hasOverflowed()) {
- CheckedUnsigned newTotalBackdropFilterArea = CheckedUnsigned(commitState.totalBackdropFilterArea) + backdropFilterArea;
+ CheckedUint32 newTotalBackdropFilterArea = CheckedUint32(commitState.totalBackdropFilterArea) + backdropFilterArea;
if (!newTotalBackdropFilterArea.hasOverflowed() && newTotalBackdropFilterArea <= cMaxTotalBackdropFilterArea) {
commitState.totalBackdropFilterArea = newTotalBackdropFilterArea;
canHaveBackdropFilters = true;
Modified: trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/cg/ImageBufferCGBitmapBackend.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -45,11 +45,11 @@
if (backendSize.isEmpty())
return backendSize;
- Checked<unsigned, RecordOverflow> bytesPerRow = 4 * Checked<unsigned, RecordOverflow>(backendSize.width());
+ auto bytesPerRow = 4 * CheckedUint32(backendSize.width());
if (bytesPerRow.hasOverflowed())
return { };
- CheckedSize numBytes = Checked<unsigned, RecordOverflow>(backendSize.height()) * bytesPerRow;
+ CheckedSize numBytes = CheckedUint32(backendSize.height()) * bytesPerRow;
if (numBytes.hasOverflowed())
return { };
Modified: trunk/Source/WebCore/platform/graphics/win/Direct2DUtilities.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/win/Direct2DUtilities.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/win/Direct2DUtilities.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -126,7 +126,7 @@
COMPtr<IWICBitmap> createDirect2DImageSurfaceWithData(void* data, const IntSize& size, unsigned stride)
{
- CheckedSize numBytes = Checked<unsigned, RecordOverflow>(size.height()) * stride;
+ CheckedSize numBytes = CheckedUint32(size.height()) * stride;
if (numBytes.hasOverflowed())
return nullptr;
Modified: trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp (278350 => 278351)
--- trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebCore/platform/graphics/win/ImageBufferDirect2DBackend.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -123,7 +123,7 @@
if (copyBehavior == CopyBackingStore && m_data.data.isEmpty())
copyBehavior = DontCopyBackingStore;
- CheckedSize numBytes = Checked<unsigned, RecordOverflow>(m_data.backingStoreSize.height()) * m_data.bytesPerRow;
+ CheckedSize numBytes = CheckedUint32(m_data.backingStoreSize.height()) * m_data.bytesPerRow;
if (numBytes.hasOverflowed())
return nullptr;
@@ -219,7 +219,7 @@
auto size = m_bitmap->GetPixelSize();
ASSERT(size.height && size.width);
- Checked<unsigned, RecordOverflow> numBytes = size.width * size.height * 4;
+ CheckedUint32 numBytes = size.width * size.height * 4;
if (numBytes.hasOverflowed())
return nullptr;
Modified: trunk/Source/WebKit/ChangeLog (278350 => 278351)
--- trunk/Source/WebKit/ChangeLog 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/ChangeLog 2021-06-02 15:42:27 UTC (rev 278351)
@@ -1,3 +1,27 @@
+2021-06-02 Chris Dumez <cdu...@apple.com>
+
+ Use Checked aliases instead of Checked<T, RecordOverflow>
+ https://bugs.webkit.org/show_bug.cgi?id=226535
+
+ Reviewed by Keith Miller.
+
+ * Shared/ShareableBitmap.cpp:
+ (WebKit::ShareableBitmap::numBytesForSize):
+ * Shared/ShareableBitmap.h:
+ * Shared/cairo/ShareableBitmapCairo.cpp:
+ (WebKit::ShareableBitmap::calculateBytesPerRow):
+ (WebKit::ShareableBitmap::calculateBytesPerPixel):
+ * Shared/cg/ShareableBitmapCG.cpp:
+ (WebKit::ShareableBitmap::calculateBytesPerRow):
+ (WebKit::ShareableBitmap::calculateBytesPerPixel):
+ * Shared/win/ShareableBitmapDirect2D.cpp:
+ (WebKit::ShareableBitmap::calculateBytesPerRow):
+ (WebKit::ShareableBitmap::calculateBytesPerPixel):
+ * UIProcess/mac/TextCheckerMac.mm:
+ (WebKit::TextChecker::updateSpellingUIWithGrammarString):
+ * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
+ (WebKit::ImageBufferShareableBitmapBackend::calculateSafeBackendSize):
+
2021-06-01 Darin Adler <da...@apple.com>
Remove <wtf/Optional.h>
Modified: trunk/Source/WebKit/Shared/ShareableBitmap.cpp (278350 => 278351)
--- trunk/Source/WebKit/Shared/ShareableBitmap.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/Shared/ShareableBitmap.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -207,7 +207,7 @@
return m_data;
}
-Checked<unsigned, RecordOverflow> ShareableBitmap::numBytesForSize(WebCore::IntSize size, const ShareableBitmap::Configuration& configuration)
+CheckedUint32 ShareableBitmap::numBytesForSize(WebCore::IntSize size, const ShareableBitmap::Configuration& configuration)
{
#if USE(DIRECT2D)
// We pass references to GPU textures, so no need to allocate frame buffers here. Just send a small bit of data.
Modified: trunk/Source/WebKit/Shared/ShareableBitmap.h (278350 => 278351)
--- trunk/Source/WebKit/Shared/ShareableBitmap.h 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/Shared/ShareableBitmap.h 2021-06-02 15:42:27 UTC (rev 278351)
@@ -84,9 +84,9 @@
Configuration m_configuration;
};
- static Checked<unsigned, RecordOverflow> numBytesForSize(WebCore::IntSize, const ShareableBitmap::Configuration&);
- static Checked<unsigned, RecordOverflow> calculateBytesPerRow(WebCore::IntSize, const Configuration&);
- static Checked<unsigned, RecordOverflow> calculateBytesPerPixel(const Configuration&);
+ static CheckedUint32 numBytesForSize(WebCore::IntSize, const ShareableBitmap::Configuration&);
+ static CheckedUint32 calculateBytesPerRow(WebCore::IntSize, const Configuration&);
+ static CheckedUint32 calculateBytesPerPixel(const Configuration&);
// Create a shareable bitmap that uses malloced memory.
static RefPtr<ShareableBitmap> create(const WebCore::IntSize&, Configuration);
Modified: trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp (278350 => 278351)
--- trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -40,12 +40,12 @@
static const cairo_format_t cairoFormat = CAIRO_FORMAT_ARGB32;
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration&)
+CheckedUint32 ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration&)
{
return cairo_format_stride_for_width(cairoFormat, size.width());
}
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerPixel(const Configuration&)
+CheckedUint32 ShareableBitmap::calculateBytesPerPixel(const Configuration&)
{
return 4;
}
Modified: trunk/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp (278350 => 278351)
--- trunk/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/Shared/cg/ShareableBitmapCG.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -70,9 +70,9 @@
return info;
}
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration& configuration)
+CheckedUint32 ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration& configuration)
{
- Checked<unsigned, RecordOverflow> bytesPerRow = calculateBytesPerPixel(configuration) * size.width();
+ CheckedUint32 bytesPerRow = calculateBytesPerPixel(configuration) * size.width();
#if HAVE(IOSURFACE)
if (bytesPerRow.hasOverflowed())
return bytesPerRow;
@@ -82,7 +82,7 @@
#endif
}
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerPixel(const Configuration& configuration)
+CheckedUint32 ShareableBitmap::calculateBytesPerPixel(const Configuration& configuration)
{
return wantsExtendedRange(configuration) ? 8 : 4;
}
Modified: trunk/Source/WebKit/Shared/win/ShareableBitmapDirect2D.cpp (278350 => 278351)
--- trunk/Source/WebKit/Shared/win/ShareableBitmapDirect2D.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/Shared/win/ShareableBitmapDirect2D.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -53,12 +53,12 @@
return bitsPerPixel * width / 8;
}
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration& configuration)
+CheckedUint32 ShareableBitmap::calculateBytesPerRow(WebCore::IntSize size, const Configuration& configuration)
{
return calculateBytesPerPixel(configuration) * size.width();
}
-Checked<unsigned, RecordOverflow> ShareableBitmap::calculateBytesPerPixel(const Configuration&)
+CheckedUint32 ShareableBitmap::calculateBytesPerPixel(const Configuration&)
{
return 4;
}
Modified: trunk/Source/WebKit/UIProcess/mac/TextCheckerMac.mm (278350 => 278351)
--- trunk/Source/WebKit/UIProcess/mac/TextCheckerMac.mm 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/UIProcess/mac/TextCheckerMac.mm 2021-06-02 15:42:27 UTC (rev 278351)
@@ -437,7 +437,7 @@
void TextChecker::updateSpellingUIWithGrammarString(SpellDocumentTag, const String& badGrammarPhrase, const GrammarDetail& grammarDetail)
{
- Checked<uint64_t, RecordOverflow> endOfRangeChecked = grammarDetail.range.location;
+ CheckedUint64 endOfRangeChecked = grammarDetail.range.location;
endOfRangeChecked += grammarDetail.range.length;
uint64_t endOfRange;
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp (278350 => 278351)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp 2021-06-02 12:37:00 UTC (rev 278350)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp 2021-06-02 15:42:27 UTC (rev 278351)
@@ -54,11 +54,11 @@
if (backendSize.isEmpty())
return { };
- Checked<unsigned, RecordOverflow> bytesPerRow = ShareableBitmap::calculateBytesPerRow(backendSize, configuration(parameters));
+ CheckedUint32 bytesPerRow = ShareableBitmap::calculateBytesPerRow(backendSize, configuration(parameters));
if (bytesPerRow.hasOverflowed())
return { };
- CheckedSize numBytes = Checked<unsigned, RecordOverflow>(backendSize.height()) * bytesPerRow;
+ CheckedSize numBytes = CheckedUint32(backendSize.height()) * bytesPerRow;
if (numBytes.hasOverflowed())
return { };