Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: b6da11826336336fb7fa9cbb748d3166946e5a96
      
https://github.com/WebKit/WebKit/commit/b6da11826336336fb7fa9cbb748d3166946e5a96
  Author: Chris Dumez <[email protected]>
  Date:   2024-04-09 (Tue, 09 Apr 2024)

  Changed paths:
    M Source/WTF/wtf/text/ASCIILiteral.h

  Log Message:
  -----------
  Indexed access on ASCIILiteral should be bounds-checked
https://bugs.webkit.org/show_bug.cgi?id=272399

Reviewed by Keith Miller and Darin Adler.

Indexed access on ASCIILiteral should be bounds-checked for safety.

It was previously possible to do indexed access on an ASCIILiteral,
despite its lack of `operator[]()`, due to the following operator:
```
constexpr operator const char*() const;
```

Upon indexed access, the ASCIILiteral would get implicitly converted
to a `const char*` and the index would thus not be bounds checked.

To address the issue, we now provide an explicit `operator[]()` which
does indexed access on our internal std::span (which does bounds check).

This tested as performance neutral on the benchmarks we track.

* Source/WTF/wtf/text/ASCIILiteral.h:

Canonical link: https://commits.webkit.org/277264@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