Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3b126365d9119fdd039d50acf2c0bcf76a348484
      
https://github.com/WebKit/WebKit/commit/3b126365d9119fdd039d50acf2c0bcf76a348484
  Author: Charlie Wolfe <[email protected]>
  Date:   2026-06-23 (Tue, 23 Jun 2026)

  Changed paths:
    M Source/WebCore/page/UserScript.cpp

  Log Message:
  -----------
  UserScript::debugDescription mishandles the substring length for the 
sourceURL prefix
https://bugs.webkit.org/show_bug.cgi?id=317176
rdar://179766868

Reviewed by Pascoe.

StringView::substring(start, length) takes a length as its second argument. 
After detecting a
"//# sourceURL=" prefix (14 characters), the code started the substring at 
offset 14 but passed pos
(the newline index) as the length, reading indices [14, 14 + pos) and 
overshooting the newline by 14
characters. As a result debugDescription() returned the sourceURL value plus 
the newline and the
following script body instead of just the sourceURL. The length must be pos - 
14, mirroring the
else-branch's substring(0, pos).

* Source/WebCore/page/UserScript.cpp:
(WebCore::UserScript::debugDescription const):

Canonical link: https://commits.webkit.org/315705@main



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

Reply via email to