Repository navigation
Commit 4b3653d
committed
Stop converting strings to lossy ASCII for logging
https://bugs.webkit.org/show_bug.cgi?id=325477
Reviewed by Darin Adler.
Many logging call sites pass String::ascii().data() because ASCIICString::data() is already a
const char*. ascii() replaces every non-ASCII character with '?', so URLs, origins, file paths
and database names containing one were logged garbled.
The LOG, RELEASE_LOG and signpost macro families convert their arguments with logPrintfType(),
and SAFE_PRINTF(), SAFE_FPRINTF() and SAFE_DATALOGF() with safePrintfType(), so these call sites
can pass String::utf8() directly. PrintStream prints a String natively, so dataLog() and
PrintStream::print() callers pass the String itself.
NetworkCache.cpp logged String::latin1().data() with %s. Calling data() bypasses the deleted
safePrintfType(const Latin1CString&), and the compiler does not flag an unsigned char* passed to
%s. The pointer cannot be rejected by type either: Latin1Character is unsigned char, the same
type as the uint8_t* pointers logged with %p. Log the URL as UTF-8 instead.
FrameIOS.mm kept a pointer into a temporary ASCIICString beyond the end of the statement that
created it. That code only builds with RECT_LOGGING, but it now passes the string to
SAFE_PRINTF() directly.
* Source/JavaScriptCore/API/JSScriptRef.cpp:
* Source/JavaScriptCore/disassembler/ARM64Disassembler.cpp:
(JSC::tryToDisassemble):
* Source/JavaScriptCore/disassembler/CapstoneDisassembler.cpp:
(JSC::tryToDisassemble):
* Source/JavaScriptCore/disassembler/X86Disassembler.cpp:
(JSC::tryToDisassemble):
* Source/JavaScriptCore/jsc.cpp:
(fillBufferWithContentsOfFile):
* Source/JavaScriptCore/wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::dumpDisassembly):
* Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp:
(JSC::IPInt::WASM_IPINT_EXTERN_CPP_DECL):
* Source/JavaScriptCore/wasm/WasmOMGPlan.cpp:
(JSC::Wasm::OMGPlan::dumpDisassembly):
* Source/JavaScriptCore/wasm/WasmOSREntryPlan.cpp:
(JSC::Wasm::OSREntryPlan::dumpDisassembly):
* Source/WebCore/Modules/webdatabase/Database.cpp:
(WebCore::Database::performOpenAndVerify):
(WebCore::Database::getVersionFromDatabase):
(WebCore::Database::setVersionInDatabase):
(WebCore::Database::markAsDeletedAndClose):
(WebCore::Database::performGetTableNames):
* Source/WebCore/Modules/webdatabase/SQLStatement.cpp:
(WebCore::SQLStatement::execute):
* Source/WebCore/history/BackForwardCache.cpp:
(WebCore::BackForwardCache::get):
* Source/WebCore/loader/ApplicationManifestLoader.cpp:
(WebCore::ApplicationManifestLoader::startLoading):
* Source/WebCore/loader/ContentFilter.cpp:
(WebCore::ContentFilter::continueAfterWillSendRequest):
(WebCore::ContentFilter::startFilteringMainResource):
(WebCore::ContentFilter::continueAfterResponseReceived):
(WebCore::ContentFilter::continueAfterDataReceived):
(WebCore::ContentFilter::continueAfterNotifyFinished):
(WebCore::ContentFilter::didDecide):
* Source/WebCore/loader/HistoryController.cpp:
(WebCore::HistoryController::updateForStandardLoad):
(WebCore::HistoryController::pushState):
(WebCore::HistoryController::updateBackForwardListForReplaceState):
* Source/WebCore/loader/icon/IconLoader.cpp:
(WebCore::IconLoader::startLoading):
(WebCore::IconLoader::notifyFinished):
* Source/WebCore/page/LocalFrame.cpp:
(WebCore::LocalFrame::injectUserScriptImmediately):
* Source/WebCore/page/WebKitNamespace.cpp:
(WebCore::WebKitNamespace::evaluateScript):
* Source/WebCore/page/ios/FrameIOS.mm:
(WebCore::LocalFrame::renderRectForPoint const):
* Source/WebCore/platform/audio/mac/AudioSessionMac.mm:
(WebCore::AudioSessionMac::setCategory):
* Source/WebCore/platform/cocoa/ContentFilterUnblockHandlerCocoa.mm:
(WebCore::ContentFilterUnblockHandler::canHandleRequest const):
* Source/WebCore/platform/encryptedmedia/CDMProxy.cpp:
(WebCore::CDMProxy::tryWaitForKeyHandle const):
(WebCore::CDMProxy::getOrWaitForKeyHandle const):
* Source/WebCore/platform/graphics/avfoundation/cf/WebCoreAVCFResourceLoader.cpp:
(WebCore::WebCoreAVCFResourceLoader::startLoading):
* Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
(WebCore::AVAudioSessionCaptureDeviceManager::setPreferredAudioSessionDeviceIDs):
* Source/WebCore/platform/network/MIMEHeader.cpp:
(WebCore::retrieveKeyValuePairs):
* Source/WebCore/platform/network/ParsedContentType.cpp:
(WebCore::ParsedContentType::parseContentType):
* Source/WebCore/platform/network/curl/CookieJarDB.cpp:
(WebCore::CookieJarDB::checkDatabaseValidity):
* Source/WebCore/platform/sql/SQLiteDatabase.cpp:
(WebCore::SQLiteDatabase::clearAllTables):
* Source/WebCore/platform/win/SearchPopupMenuDB.cpp:
(WebCore::SearchPopupMenuDB::checkDatabaseValidity):
* Source/WebKit/NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::retrieve):
(WebKit::NetworkCache::Cache::completeRetrieve):
(WebKit::NetworkCache::Cache::retrieveCompressionDictionaryBestMatch):
* Source/WebKit/NetworkProcess/glib/NetworkMDNSRegisterGLib.cpp:
(WebKit::NetworkMDNSRegister::registerMDNSName):
* Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp:
(WebKit::NetworkStorageManager::performEvictionForOrigin):
(WebKit::NetworkStorageManager::donePrepareForTimeBasedEviction):
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::didGeneratePageLoadTiming):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::runJavaScriptInFrameInScriptWorld):
(WebKit::logFrameTreeHelper):
(WebKit::WebPageProxy::logFrameTree):
* Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCompositor.cpp:
(WebKit::ThreadedCompositor::renderLayerTree):
(WebKit::ThreadedCompositor::scheduleUpdateLocked):
(WebKit::ThreadedCompositor::frameComplete):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::clearContentWorld):
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::accessibilityFocusedUIElement):
* Source/WebKit/webpushd/PushService.mm:
(WebPushD::PushService::subscribe):
(WebPushD::PushService::removeRecordsForBundleIdentifierAndDataStore):
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::WebPushDaemon::connectionEventHandler):
(WebPushD::WebPushDaemon::updateSubscriptionSetState):
(WebPushD::WebPushDaemon::setPushAndNotificationsEnabledForOrigin):
(WebPushD::WebPushDaemon::subscribeToPushService):
(WebPushD::WebPushDaemon::unsubscribeFromPushService):
(WebPushD::WebPushDaemon::getPushSubscription):
(WebPushD::WebPushDaemon::incrementSilentPushCount):
(WebPushD::WebPushDaemon::removePushSubscriptionsForOrigin):
(WebPushD::WebPushDaemon::showNotification):
(WebPushD::WebPushDaemon::getNotifications):
(WebPushD::WebPushDaemon::cancelNotification):
(WebPushD::WebPushDaemon::getPushPermissionState):
(WebPushD::WebPushDaemon::requestPushPermission):
(WebPushD::WebPushDaemon::setAppBadge):
* Source/WebKitLegacy/Storage/StorageTracker.cpp:
(WebKit::StorageTracker::openTrackerDatabase):
(WebKit::StorageTracker::syncSetOriginDetails):
(WebKit::StorageTracker::syncDeleteOrigin):
(WebKit::StorageTracker::databasePathForOrigin):
Canonical link: https://commits.webkit.org/322114@main1 parent 8510dfc commit 4b3653d
40 files changed
Lines changed: 102 additions & 104 deletions
File tree
- Source
- JavaScriptCore
- API
- disassembler
- wasm
- WebCore
- Modules/webdatabase
- history
- loader
- icon
- page
- ios
- platform
- audio/mac
- cocoa
- encryptedmedia
- graphics/avfoundation/cf
- mediastream/ios
- network
- curl
- sql
- win
- WebKitLegacy/Storage
- WebKit
- NetworkProcess
- cache
- glib
- storage
- UIProcess
- Cocoa
- WebProcess
- WebPage
- CoordinatedGraphics
- cocoa
- webpushd
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
116 | | - | |
| 116 | + | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| |||
140 | 140 | | |
141 | 141 | | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
179 | 179 | | |
180 | 180 | | |
181 | 181 | | |
182 | | - | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1366 | 1366 | | |
1367 | 1367 | | |
1368 | 1368 | | |
1369 | | - | |
| 1369 | + | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1024 | 1024 | | |
1025 | 1025 | | |
1026 | 1026 | | |
1027 | | - | |
| 1027 | + | |
1028 | 1028 | | |
1029 | 1029 | | |
1030 | | - | |
| 1030 | + | |
1031 | 1031 | | |
1032 | 1032 | | |
1033 | | - | |
| 1033 | + | |
1034 | 1034 | | |
1035 | 1035 | | |
1036 | 1036 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
352 | 352 | | |
353 | 353 | | |
354 | 354 | | |
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
| 380 | + | |
381 | 381 | | |
382 | | - | |
| 382 | + | |
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
| |||
394 | 394 | | |
395 | 395 | | |
396 | 396 | | |
397 | | - | |
| 397 | + | |
398 | 398 | | |
399 | 399 | | |
400 | 400 | | |
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
454 | | - | |
| 454 | + | |
455 | 455 | | |
456 | 456 | | |
457 | 457 | | |
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| |||
566 | 566 | | |
567 | 567 | | |
568 | 568 | | |
569 | | - | |
| 569 | + | |
570 | 570 | | |
571 | 571 | | |
572 | 572 | | |
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
706 | | - | |
| 706 | + | |
707 | 707 | | |
708 | 708 | | |
709 | 709 | | |
| |||
719 | 719 | | |
720 | 720 | | |
721 | 721 | | |
722 | | - | |
| 722 | + | |
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
| |||
0 commit comments