Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8b5404a28cd2be95475cb4e7faa1d3f451359c2a
      
https://github.com/WebKit/WebKit/commit/8b5404a28cd2be95475cb4e7faa1d3f451359c2a
  Author: David Kilzer <ddkil...@apple.com>
  Date:   2024-09-27 (Fri, 27 Sep 2024)

  Changed paths:
    M Source/WTF/wtf/Compiler.h
    M Source/WTF/wtf/HexNumber.h
    M Source/WebCore/platform/network/FormDataBuilder.cpp

  Log Message:
  -----------
  [WTF] HexNumberBuffer::span() should not ignore std::array size
<https://bugs.webkit.org/show_bug.cgi?id=280496>
<rdar://136802343>

Reviewed by Geoffrey Garen.

Fix construction of HexNumberBuffer::span() to convert std::array first,
then create a subspan from the last N characters.

Remove unsafe characters() methods and use span() instead.

Introduce LIFETIME_BOUND attribute to prevent use-after-free bugs with
C++ temporary objects.  (I accidentally introduced this bug in a local
version of this change before posting it.)

* Source/WTF/wtf/Compiler.h:
(LIFETIME_BOUND): Add.
- Add support for the lifetimebound attribute in clang and gcc.

* Source/WTF/wtf/HexNumber.h:
(WTF::HexNumberBuffer::characters const): Delete.
- Remove unsafe method.
(WTF::HexNumberBuffer::span const):
- Adopt LIFETIME_BOUND attribute for this method.
- Change to construct std::span directly from std::array, then use
  std::span::last() to create a span of the last N elements.
(WTF::StringTypeAdapter<HexNumberBuffer>::characters const): Delete.
- Remove unused method.

* Source/WebCore/platform/network/FormDataBuilder.cpp:
(WebCore::FormDataBuilder::appendFormURLEncoded):
- Switch to use HexNumberBuffer::span(), but keep hexBuffer alive on the
  stack.

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



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

Reply via email to