Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c5828885fb55a552418724ce311f6f23e214d62f
      
https://github.com/WebKit/WebKit/commit/c5828885fb55a552418724ce311f6f23e214d62f
  Author: Chris Dumez <[email protected]>
  Date:   2026-09-29 (Tue, 29 Sep 2026)

  Changed paths:
    M Source/WebDriver/soup/WebSocketServerSoup.cpp
    M Tools/Scripts/webkitpy/style/checkers/cpp.py
    M Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py

  Log Message:
  -----------
  Add style checks for strings unwrapped for logging macros and for dataLogF()
https://bugs.webkit.org/show_bug.cgi?id=325746

Reviewed by Darin Adler.

The LOG, RELEASE_LOG, ASSERT_WITH_MESSAGE and SAFE_PRINTF families convert 
typed string
arguments themselves, so unwrapping a string with legacyCStringPointer() for 
them is never
needed, and passing .ascii().data() or .latin1().data() loses non-ASCII 
characters. Add a
runtime/log_string_conversion check that flags these
arguments and suggests passing the typed
string, or .utf8(), instead. The check only looks at direct arguments of the 
macro, and skips
the RELEASE_LOG _FORWARDABLE variants, which take typed parameters rather than 
printf arguments.

Fix the one existing call site it flags.

Also make safercpp/printf flag dataLogF() and suggest SAFE_DATALOGF(), as it 
already does for
printf(), fprintf() and snprintf().

* Source/WebDriver/soup/WebSocketServerSoup.cpp:
(WebDriver::handleIncomingHandshake):
* Tools/Scripts/webkitpy/style/checkers/cpp.py:
(check_glib_string_wrappers):
(_is_typed_string_printf_macro):
(check_log_string_conversions):
(check_safer_cpp):
(check_style):
(CppChecker):
* Tools/Scripts/webkitpy/style/checkers/cpp_unittest.py:
(WebKitStyleTest.test_log_string_conversions):
(WebKitStyleTest.test_safer_cpp):

Canonical link:
https://flagged.apple.com:443/proxy?t2=DN2M8S3ni1&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIyMjQ4QG1haW4=&emid=98e7042f-c591-429a-9b5b-7c1f03ff52c4&c=11



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to