Skip to content

Commit 9b61e37

Browse files
committed
Prepare for -Wunsafe-buffer-usage-in-libc-call
https://bugs.webkit.org/show_bug.cgi?id=286175 rdar://143158556 Reviewed by Chris Dumez. I enabled the setting locally and bracketed the failures with skip macros. I also fixed a couple hyper-trivial cases. We now have an Apple-port specific skip, so Apple engineers searching for skips needs two regexes: WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN(?! //.*port) and WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN.*[^-]Apple * Source/JavaScriptCore/API/PASReportCrashPrivate.cpp: * Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp: * Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp: (testFunctionOverrides): * Source/JavaScriptCore/API/tests/FunctionToStringTests.cpp: (testFunctionToString): * Source/JavaScriptCore/API/tests/JSObjectGetProxyTargetTest.cpp: (testJSObjectGetProxyTarget): * Source/JavaScriptCore/API/tests/MultithreadedMultiVMExecutionTest.cpp: (startMultithreadedMultiVMExecutionTest): * Source/JavaScriptCore/API/tests/testapi.mm: (blockSignatureContainsClass): (cacheFileInDataVault): * Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py: * Source/JavaScriptCore/assembler/AssemblerCommon.h: * Source/JavaScriptCore/assembler/Printer.h: * Source/JavaScriptCore/b3/B3ValueRep.h: * Source/JavaScriptCore/b3/testb3.h: * Source/JavaScriptCore/bytecode/PropertyCondition.h: (JSC::PropertyCondition::PropertyCondition): * Source/JavaScriptCore/bytecode/SpeculatedType.cpp: (JSC::speculationFromString): * Source/JavaScriptCore/dfg/DFGAbstractValue.cpp: (JSC::DFG::AbstractValue::ensureCanInitializeWithZeros): * Source/JavaScriptCore/dfg/DFGVariableEvent.cpp: * Source/JavaScriptCore/heap/BlockDirectory.cpp: (JSC::BlockDirectory::dumpBits): * Source/JavaScriptCore/heap/Heap.cpp: (JSC::Heap::runFixpointPhase): * Source/JavaScriptCore/heap/PreciseAllocation.cpp: (JSC::PreciseAllocation::tryReallocate): * Source/JavaScriptCore/inspector/ContentSearchUtilities.cpp: (Inspector::ContentSearchUtilities::escapeStringForRegularExpressionSource): * Source/JavaScriptCore/jit/CallFrameShuffler.cpp: * Source/JavaScriptCore/jit/ExecutableAllocator.cpp: (JSC::initializeSeparatedWXHeaps): * Source/JavaScriptCore/jit/ICStats.cpp: (JSC::ICEvent::operator< const): * Source/JavaScriptCore/jsc.cpp: * Source/JavaScriptCore/runtime/ExceptionFuzz.cpp: (JSC::doExceptionFuzzing): * Source/JavaScriptCore/runtime/FuzzerPredictions.cpp: (JSC::readFileIntoString): * Source/JavaScriptCore/runtime/GenericTypedArrayViewInlines.h: (JSC::GenericTypedArrayView<Adaptor>::tryCreate): * Source/JavaScriptCore/runtime/IndexingType.cpp: (JSC::dumpIndexingType): * Source/JavaScriptCore/runtime/InitializeThreading.cpp: * Source/JavaScriptCore/runtime/Options.cpp: * Source/JavaScriptCore/runtime/VM.cpp: (JSC::enableAssembler): * Source/JavaScriptCore/tools/CompilerTimingScope.cpp: * Source/JavaScriptCore/tools/FunctionOverrides.cpp: (JSC::parseClause): (JSC::FunctionOverrides::parseOverridesInFile): * Source/JavaScriptCore/tools/Integrity.cpp: * Source/JavaScriptCore/wasm/WasmValueLocation.h: * Source/WTF/wtf/DateMath.cpp: (WTF::findMonth): (WTF::parseInt): (WTF::parseLong): * Source/WTF/wtf/FastMalloc.cpp: * Source/WTF/wtf/FastMalloc.h: * Source/WTF/wtf/FilePrintStream.cpp: (WTF::FilePrintStream::vprintf): * Source/WTF/wtf/Int128.cpp: (WTF::printInternal): * Source/WTF/wtf/LockedPrintStream.cpp: (WTF::LockedPrintStream::vprintf): * Source/WTF/wtf/NumberOfCores.cpp: (WTF::numberOfProcessorCores): * Source/WTF/wtf/PrintStream.cpp: * Source/WTF/wtf/PrintStream.h: (WTF::printInternal): * Source/WTF/wtf/SafeStrerror.cpp: (WTF::safeStrerror): * Source/WTF/wtf/ScopedPrintStream.h: * Source/WTF/wtf/StackTrace.cpp: (WTF::StackTracePrinter::dump const): * Source/WTF/wtf/StringPrintStream.cpp: * Source/WTF/wtf/SystemMalloc.h: (WTF::SystemMalloc::zeroedMalloc): (WTF::SystemMalloc::tryZeroedMalloc): * Source/WTF/wtf/URL.cpp: (WTF::URL::print const): * Source/WTF/wtf/cocoa/CrashReporter.cpp: (WTF::setCrashLogMessage): * Source/WTF/wtf/cocoa/FileSystemCocoa.mm: (WTF::FileSystemImpl::openTemporaryFile): * Source/WTF/wtf/cocoa/NSURLExtras.mm: (WTF::readIDNAllowedScriptListFile): * Source/WTF/wtf/cocoa/SystemTracingCocoa.cpp: (WTFSignpostHandleIndirectLog): * Source/WTF/wtf/darwin/LibraryPathDiagnostics.mm: (WTF::LibraryPathDiagnosticsLogger::logError): * Source/WTF/wtf/dtoa/utils.h: (WTF::double_conversion::StrLength): (WTF::double_conversion::StringBuilder::AddSubstring): (WTF::double_conversion::StringBuilder::Finalize): * Source/WTF/wtf/posix/ThreadingPOSIX.cpp: (WTF::Thread::initializePlatformThreading): * Source/WTF/wtf/text/ASCIILiteral.h: (WTF::operator==): * Source/WTF/wtf/text/CString.cpp: (WTF::operator==): (WTF::operator<): * Source/WTF/wtf/text/StringCommon.h: (WTF::span8): (WTF::span8IncludingNullTerminator): (WTF::span): (WTF::spanIncludingNullTerminator): * Source/WTF/wtf/text/TextStream.cpp: (WTF::TextStream::operator<<): * Source/WTF/wtf/text/icu/UTextProvider.cpp: (WTF::uTextCloneImpl): * Source/WTF/wtf/text/icu/UTextProviderLatin1.cpp: (WTF::uTextLatin1Clone): (WTF::openLatin1UTextProvider): * Source/WTF/wtf/threads/Signals.cpp: * Source/WTF/wtf/unicode/icu/CollatorICU.cpp: (WTF::copyShortASCIIString): (WTF::localesMatch): (WTF::createIterator): * Source/WebCore/Modules/websockets/WebSocketExtensionParser.cpp: (WebCore::isSeparator): * Source/WebCore/PAL/pal/text/TextCodec.cpp: (PAL::TextCodec::getUnencodableReplacement): * Source/WebCore/PAL/pal/text/TextCodecICU.cpp: (PAL::TextCodecICU::createICUConverter const): (PAL::ErrorCallbackSetter::~ErrorCallbackSetter): * Source/WebCore/PAL/pal/text/TextEncodingRegistry.cpp: (PAL::isUndesiredAlias): (PAL::WTF_REQUIRES_LOCK): * Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperBase.mm: (accessibilitySearchCriteriaForSearchPredicate): * Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm: (parameterizedAttributeValueForTesting): (formatForDebugger): (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:forParameter:]): * Source/WebCore/css/CSSSelectorList.cpp: (WebCore::CSSSelectorList::CSSSelectorList): * Source/WebCore/css/StyleProperties.cpp: (WebCore::StyleProperties::showStyle): * Source/WebCore/dom/ElementData.cpp: (WebCore::UniqueElementData::UniqueElementData): * Source/WebCore/dom/Node.cpp: (WebCore::Node::dumpStatistics): (WebCore::showSubTreeAcrossFrame): * Source/WebCore/dom/Position.cpp: * Source/WebCore/dom/TextDecoder.cpp: (WebCore::TextDecoder::create): * Source/WebCore/editing/VisiblePosition.cpp: (WebCore::VisiblePosition::debugPosition const): * Source/WebCore/editing/VisibleSelection.cpp: * Source/WebCore/history/HistoryItem.cpp: (WebCore::HistoryItem::showTreeWithIndent const): * Source/WebCore/html/HTMLAttachmentElement.cpp: (WebCore::compactStackTrace): * Source/WebCore/html/HTMLElement.cpp: (dumpInnerHTML): * Source/WebCore/html/ImageDataArray.cpp: (WebCore::fillTypedArray): * Source/WebCore/layout/layouttree/LayoutTreeBuilder.cpp: (WebCore::Layout::printLayoutTreeForLiveDocuments): * Source/WebCore/loader/TextResourceDecoder.h: (WebCore::TextResourceDecoder::setAlwaysUseUTF8): * Source/WebCore/loader/appcache/ApplicationCache.cpp: (WebCore::ApplicationCache::dump): * Source/WebCore/page/FrameTree.cpp: * Source/WebCore/page/PrintContext.cpp: (WebCore::PrintContext::pageProperty): * Source/WebCore/platform/FileHandle.cpp: * Source/WebCore/platform/SharedMemory.cpp: (WebCore::isMemoryAttributionDisabled): * Source/WebCore/platform/audio/SincResampler.cpp: (WebCore::SincResampler::SincResampler): * Source/WebCore/platform/audio/cocoa/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): (WebCore::WebAudioBufferList::reset): * Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp: (WebCore::GraphicsContextGLANGLE::getBufferSubDataImpl): * Source/WebCore/platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: (WebCore::AudioSourceProviderAVFObjC::prepare): * Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm: (WebCore::initializeEGLDisplay): (WebCore::GraphicsContextGLCocoa::platformInitializeContext): * Source/WebCore/platform/graphics/cocoa/TransformationMatrixCocoa.cpp: * Source/WebCore/platform/graphics/cocoa/WebMAudioUtilitiesCocoa.mm: (WebCore::parseOpusPrivateData): * Source/WebCore/platform/mac/CursorMac.mm: (WebCore::cursor): * Source/WebCore/platform/network/FormDataBuilder.cpp: (WebCore::FormDataBuilder::appendFormURLEncoded): * Source/WebCore/platform/sql/SQLiteFileSystem.cpp: (WebCore::SQLiteFileSystem::setCanSuspendLockedFileAttribute): * Source/WebCore/platform/text/SegmentedString.cpp: (WebCore::SegmentedString::advancePastSlowCase): * Source/WebCore/platform/text/SegmentedString.h: (WebCore::SegmentedString::advancePast): * Source/WebCore/rendering/CounterNode.cpp: (WebCore::showTreeAndMark): * Source/WebCore/rendering/RenderLayer.cpp: (WebCore::showLayerTree): * Source/WebCore/rendering/RenderQuote.cpp: (WebCore::subtagCompare): (WebCore::quotesForLanguage): * Source/WebGPU/WebGPU/RenderBundle.mm: (WebGPU::RenderBundle::RenderBundle): * Source/WebGPU/WebGPU/RenderBundleEncoder.mm: (WebGPU::RenderBundleEncoder::RenderBundleEncoder): * Source/WebGPU/WebGPU/RenderPassEncoder.mm: (WebGPU::RenderPassEncoder::RenderPassEncoder): * Source/WebGPU/WebGPU/RenderPipeline.mm: (WebGPU::RenderPipeline::RenderPipeline): * Source/WebKit/NetworkProcess/Authentication/cocoa/AuthenticationManagerCocoa.mm: (WebKit::AuthenticationManager::initializeConnection): * Source/WebKit/NetworkProcess/cache/NetworkCacheStorage.cpp: (WebKit::NetworkCache::Storage::deleteOldVersions): * Source/WebKit/Shared/API/Cocoa/WKRemoteObjectCoder.mm: (encodeInvocationArguments): (crashWithClassName): (decodeInvocationArguments): * Source/WebKit/Shared/API/Cocoa/_WKRemoteObjectRegistry.mm: (-[_WKRemoteObjectRegistry _sendInvocation:interface:]): (-[_WKRemoteObjectRegistry _invokeMethod:]): * Source/WebKit/Shared/Cocoa/CoreIPCNSValue.mm: (WebKit::CoreIPCNSValue::valueFromNSValue): * Source/WebKit/Shared/Cocoa/SandboxExtensionCocoa.mm: (WebKit::SandboxExtensionImpl::create): (WebKit::SandboxExtensionImpl::~SandboxExtensionImpl): (WebKit::SandboxExtensionImpl::getSerializedFormat): (WebKit::SandboxExtension::createHandleForTemporaryFile): * Source/WebKit/Shared/EntryPointUtilities/Cocoa/Daemon/PCMDaemonEntryPoint.mm: * Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCEndpointMessages.mm: (WebKit::handleXPCEndpointMessage): * Source/WebKit/Shared/EntryPointUtilities/Cocoa/XPCService/XPCServiceMain.mm: (WebKit::XPCServiceEventHandler): * Source/WebKit/Shared/Extensions/WebExtensionUtilities.cpp: * Source/WebKit/Shared/Extensions/_WKWebExtensionSQLiteDatatypeTraits.h: (WebKit::_WKWebExtensionSQLiteDatatypeTraits<NSNumber::bind): * Source/WebKit/Shared/WebMemorySampler.cpp: (WebKit::WebMemorySampler::initializeTimers): (WebKit::WebMemorySampler::stop): (WebKit::WebMemorySampler::stopTimerFired): * Source/WebKit/Shared/mac/AuxiliaryProcessMac.mm: (WebKit::compileAndCacheSandboxProfile): (WebKit::tryApplyCachedSandbox): * Source/WebKit/Shared/mac/WebMemorySampler.mac.mm: (WebKit::WebMemorySampler::sampleSystemMalloc const): * Source/WebKit/UIProcess/Cocoa/WebKitSwiftSoftLink.mm: (WebKit::WebKitSwiftLibrary): * Source/WebKit/UIProcess/Launcher/cocoa/ProcessLauncherCocoa.mm: (WebKit::ProcessLauncher::finishLaunchingProcess): * Source/WebKit/UIProcess/mac/WebPageProxyMac.mm: (WebKit::pathToPDFOnDisk): * Source/WebKit/WebProcess/Plugins/PDF/PDFScriptEvaluation.mm: (WebKit::PDFScriptEvaluation::pdfDocumentContainsPrintScript): * Source/WebKit/WebProcess/WebPage/mac/WKAccessibilityWebPageObjectMac.mm: (-[WKAccessibilityWebPageObject accessibilityAttributeValue:forParameter:]): * Source/WebKit/webpushd/webpushtool/WebPushToolConnection.mm: (WebPushTool::Connection::connectToService): (WebPushTool::Connection::sendPushMessage): (WebPushTool::Connection::getPushPermissionState): (WebPushTool::Connection::requestPushPermission): (WebPushTool::Connection::sendAuditToken): * Source/WebKit/webpushd/webpushtool/WebPushToolMain.mm: * Source/bmalloc/bmalloc/CompactAllocationMode.h: Canonical link: https://commits.webkit.org/289133@main
1 parent 0160d3a commit 9b61e37

131 files changed

Lines changed: 440 additions & 7 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/JavaScriptCore/API/PASReportCrashPrivate.cpp‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525

2626
#include "config.h"
2727
#include "PASReportCrashPrivate.h"
28+
#include <wtf/Compiler.h>
29+
30+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN // Apple ports
2831

2932
#if !USE(SYSTEM_MALLOC)
3033
#include <bmalloc/BPlatform.h>
@@ -33,6 +36,8 @@
3336
#endif
3437
#endif
3538

39+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
40+
3641
using namespace JSC;
3742

3843
#ifdef __APPLE__

‎Source/JavaScriptCore/API/tests/ExecutionTimeLimitTest.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242
#include <dispatch/dispatch.h>
4343
#endif
4444

45+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
46+
4547
using JSC::Options;
4648

4749
static JSGlobalContextRef context = nullptr;
@@ -564,3 +566,5 @@ int testExecutionTimeLimit()
564566

565567
return failed;
566568
}
569+
570+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END

‎Source/JavaScriptCore/API/tests/FunctionOverridesTest.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ int testFunctionOverrides()
8383
JSC::Options::functionOverrides() = oldFunctionOverrides;
8484
JSC::FunctionOverrides::reinstallOverrides();
8585

86+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
8687
printf("%s: function override tests.\n", failed ? "FAIL" : "PASS");
88+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
8789

8890
return failed;
8991
}

‎Source/JavaScriptCore/API/tests/FunctionToStringTests.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ int testFunctionToString()
106106
failed = true;
107107

108108
JSGlobalContextRelease(context);
109+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
109110
printf("%s: function toString tests.\n", failed ? "FAIL" : "PASS");
111+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
110112

111113
return failed;
112114
}

‎Source/JavaScriptCore/API/tests/JSObjectGetProxyTargetTest.cpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ int testJSObjectGetProxyTarget()
4343
printf("JSObjectGetProxyTargetTest:\n");
4444

4545
auto test = [&] (const char* description, bool currentResult) {
46+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
4647
printf(" %s: %s\n", description, currentResult ? "PASS" : "FAIL");
48+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
4749
overallResult &= currentResult;
4850
};
4951

@@ -98,7 +100,9 @@ int testJSObjectGetProxyTarget()
98100
JSGlobalContextRelease(context);
99101
JSContextGroupRelease(group);
100102

103+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
101104
printf("JSObjectGetProxyTargetTest: %s\n", overallResult ? "PASS" : "FAIL");
105+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
102106
return !overallResult;
103107
}
104108

‎Source/JavaScriptCore/API/tests/MultithreadedMultiVMExecutionTest.cpp‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ void startMultithreadedMultiVMExecutionTest()
5353

5454
#define CHECK(condition, threadNumber, count, message) do { \
5555
if (!condition) { \
56+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN \
5657
printf("FAIL: MultithreadedMultiVMExecutionTest: %d %d %s\n", threadNumber, count, message); \
58+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END \
5759
failuresFound++; \
5860
} \
5961
} while (false)
@@ -86,11 +88,15 @@ void startMultithreadedMultiVMExecutionTest()
8688
buffer.resize(JSStringGetMaximumUTF8CStringSize(string));
8789
JSStringGetUTF8CString(string, buffer.data(), buffer.size());
8890
IGNORE_GCC_WARNINGS_BEGIN("format-overflow")
91+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
8992
printf("FAIL: MultithreadedMultiVMExecutionTest: %d %d %s\n", threadNumber, i, buffer.data());
93+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
9094
IGNORE_GCC_WARNINGS_END
9195
JSStringRelease(string);
9296
} else
97+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
9398
printf("FAIL: MultithreadedMultiVMExecutionTest: %d %d stringifying exception failed\n", threadNumber, i);
99+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
94100
}
95101
CHECK(jsScript, threadNumber, i, "script eval");
96102
JSStringRelease(jsScriptString);
@@ -112,6 +118,8 @@ int finalizeMultithreadedMultiVMExecutionTest()
112118
for (auto& thread : threads)
113119
thread.join();
114120

121+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
115122
printf("%s: MultithreadedMultiVMExecutionTest\n", failuresFound ? "FAIL" : "PASS");
123+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
116124
return (failuresFound > 0);
117125
}

‎Source/JavaScriptCore/API/tests/testapi.mm‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,9 @@ static bool blockSignatureContainsClass()
493493
{
494494
static bool containsClass = ^{
495495
id block = ^(NSString *string){ return string; };
496+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
496497
return _Block_has_signature(block) && strstr(_Block_signature(block), "NSString");
498+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
497499
}();
498500
return containsClass;
499501
}
@@ -2088,7 +2090,9 @@ static void testImportModuleTwice()
20882090
char userDir[PATH_MAX];
20892091
RELEASE_ASSERT(confstr(_CS_DARWIN_USER_DIR, userDir, sizeof(userDir)));
20902092

2093+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
20912094
NSString *userDirPath = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:userDir length:strlen(userDir)];
2095+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
20922096
dataVaultURL = [NSURL fileURLWithPath:userDirPath isDirectory:YES];
20932097
dataVaultURL = [dataVaultURL URLByAppendingPathComponent:@"JavaScriptCore" isDirectory:YES];
20942098
rootless_mkdir_datavault(dataVaultURL.path.UTF8String, 0700, "JavaScriptCore");

‎Source/JavaScriptCore/Scripts/wkbuiltins/builtins_templates.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class BuiltinsGeneratorTemplates:
132132
explicit ${objectName}BuiltinsWrapper(JSC::VM& vm)
133133
: m_vm(vm)
134134
${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_FUNCTION_NAME(INITIALIZE_BUILTIN_NAMES)
135-
#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying({ s_##name, static_cast<size_t>(length) }), { }, JSC::SourceTaintedOrigin::Untainted))
135+
#define INITIALIZE_BUILTIN_SOURCE_MEMBERS(name, functionName, overriddenName, length) , m_##name##Source(JSC::makeSource(StringImpl::createWithoutCopying(unsafeMakeSpan(s_##name, static_cast<size_t>(length))), { }, JSC::SourceTaintedOrigin::Untainted))
136136
${macroPrefix}_FOREACH_${objectMacro}_BUILTIN_CODE(INITIALIZE_BUILTIN_SOURCE_MEMBERS)
137137
#undef INITIALIZE_BUILTIN_SOURCE_MEMBERS
138138
{

‎Source/JavaScriptCore/assembler/AssemblerCommon.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,8 @@ enum class MachineCodeCopyMode : uint8_t {
356356
JITMemcpy,
357357
};
358358

359+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
360+
359361
static ALWAYS_INLINE void* memcpyAtomicIfPossible(void* dst, const void* src, size_t n)
360362
{
361363
#if !CPU(NEEDS_ALIGNED_ACCESS)
@@ -404,4 +406,6 @@ ALWAYS_INLINE void* machineCodeCopy(void* dst, const void* src, size_t n)
404406
return performJITMemcpy(dst, src, n);
405407
}
406408

409+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
410+
407411
} // namespace JSC.

‎Source/JavaScriptCore/assembler/Printer.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ union Data {
4545
Data()
4646
{
4747
const intptr_t uninitialized = 0xdeadb0d0;
48+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
4849
memcpy(&buffer, &uninitialized, sizeof(uninitialized));
50+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
4951
}
5052
Data(uintptr_t value)
5153
: Data(&value, sizeof(value))
@@ -56,7 +58,9 @@ union Data {
5658
Data(void* src, size_t size)
5759
{
5860
RELEASE_ASSERT(size <= sizeof(buffer));
61+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_BEGIN
5962
memcpy(&buffer, src, size);
63+
WTF_ALLOW_UNSAFE_BUFFER_USAGE_END
6064
}
6165

6266
template<typename T, typename = typename std::enable_if<std::is_integral<T>::value>::type>

0 commit comments

Comments
 (0)