Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: adef225a2b98479de735c4839850a0b0118ff689
      
https://github.com/WebKit/WebKit/commit/adef225a2b98479de735c4839850a0b0118ff689
  Author: Geoffrey Garen <gga...@apple.com>
  Date:   2025-02-10 (Mon, 10 Feb 2025)
  Changed paths:
    M Source/WTF/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations
    M Source/WTF/wtf/StdLibExtras.h
    M Source/WTF/wtf/text/cf/StringImplCF.cpp

  Log Message:
  -----------
  Address WTF_ALLOW_UNSAFE_BUFFER_USAGE and static analysis warnings in 
StringImplCF.cpp
https://bugs.webkit.org/show_bug.cgi?id=287287
rdar://144407846

Reviewed by Ryosuke Niwa.

This operation will never be totally safe because it interacts with malloc-like
APIs. But we can compose it on top of lower level primitives to avoid scattering
WTF_ALLOW_UNSAFE_BUFFER_USAGE across the codebase, and to ensure some more
safety details than before.

* Source/WTF/wtf/StdLibExtras.h:
(WTF::destroyWithTrailingBytes): New helpers for dealing with an allocation that
requires trailing bytes. (This is kinda like TrailingArray, but not quite.)

These new helpers are a little safer than what we had before because
* they honor constructor/destructor semantics, including smart pointers
* they enable the caller to express itself in terms of (mostly) safe 
abstractions

* Source/WTF/wtf/text/cf/StringImplCF.cpp:
(WTF::StringWrapperCFAllocator::allocate):
(WTF::StringWrapperCFAllocator::reallocate):
(WTF::StringWrapperCFAllocator::deallocate): Use our (mostly) safe abstractions

* Source/WTF/SaferCPPExpectations/UncountedLocalVarsCheckerExpectations:
Fixed a failure.

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