[Webkit-unassigned] [Bug 231986] Fix crash when calling setUsernameForLocalCredentialWithID

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Oct 19 16:36:10 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=231986

David Kilzer (:ddkilzer) <ddkilzer at webkit.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ddkilzer at webkit.org
 Attachment #441811|review?                     |review+
              Flags|                            |

--- Comment #3 from David Kilzer (:ddkilzer) <ddkilzer at webkit.org> ---
Comment on attachment 441811
  --> https://bugs.webkit.org/attachment.cgi?id=441811
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=441811&action=review

r=me

> Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:341
>      auto updatedTag = cbor::CBORWriter::write(cbor::CBORValue(WTFMove(updatedUserMap)));
> -    auto secAttrApplicationTag = [NSData dataWithBytesNoCopy:updatedTag->data() length:updatedTag->size()];
> +
> +    auto secAttrApplicationTag = adoptNS([[NSData alloc] initWithBytes:updatedTag->data() length:updatedTag->size()]);

It's a good idea not to copy memory if you don't have to, but +[NSData dataWithBytesNoCopy:length:] requires that the object that holds the bytes stay alive until the NSData object is deallocated.

This looks like the correct fix.

> Source/WebKit/UIProcess/API/Cocoa/_WKWebAuthenticationPanel.mm:344
> -        (__bridge id)kSecAttrApplicationTag: secAttrApplicationTag,
> +        (__bridge id)kSecAttrApplicationTag: secAttrApplicationTag.get(),

In place of using (__bridge id) cast, you can use the new bridge_id_cast() helper function in <wtf/cocoa/TypeCastsCocoa.h>.

This change is not required to land the patch, though.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20211019/6db749fe/attachment-0001.htm>


More information about the webkit-unassigned mailing list