Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 93c07006702a6547f94575c65454e822e5b6e0ef
      
https://github.com/WebKit/WebKit/commit/93c07006702a6547f94575c65454e822e5b6e0ef
  Author: Chris Dumez <[email protected]>
  Date:   2025-09-17 (Wed, 17 Sep 2025)

  Changed paths:
    M Source/WTF/wtf/cocoa/NSURLExtras.mm
    M Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm

  Log Message:
  -----------
  Crash in subspan() in URLByRemovingUserInfo() in NSURLExtras
https://bugs.webkit.org/show_bug.cgi?id=298995
rdar://160723558

Reviewed by Darin Adler.

The logic in the subspan() was wrong as we were missing parentheses.
As a result, the length would end up way larger than the span size
and we would hit the assertion in `subspan()`.

The following:
```
urlBytes.subspan(range.location + range.length, numBytes - range.location + 
range.length)
```
should have been:
```
urlBytes.subspan(range.location + range.length, numBytes - (range.location + 
range.length))
```

But also, we don't even need to provide the second parameter to `subspan()` 
here since
we're computing the length of the rest of the span, which is what subspan does 
by default.

* Source/WTF/wtf/cocoa/NSURLExtras.mm:
(WTF::URLByRemovingComponentAndSubsequentCharacter):
* Tools/TestWebKitAPI/Tests/WTF/cocoa/URLExtras.mm:
(TestWebKitAPI::TEST(URLExtras, URLByRemovingUserInfo)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to