[Webkit-unassigned] [Bug 173690] New: [TestWebKitAPI] Fix misuse of -[NSData dataWithBytesNoCopy:length:] with global variables

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 21 20:12:00 PDT 2017


            Bug ID: 173690
           Summary: [TestWebKitAPI] Fix misuse of -[NSData
                    dataWithBytesNoCopy:length:] with global variables
           Product: WebKit
           Version: WebKit Nightly Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Tools / Tests
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: ddkilzer at webkit.org
                CC: lforschler at apple.com

Per documentation, -[NSData dataWithBytesNoCopy:length:] takes
ownership of malloc()-ed memory, then frees it when it's
released.  These tests were passing global variables into the
method, which is not malloc()-ed memory, which violations the
API contract.

The fix is to switch to using -[NSData dataWithBytes:length:] so
that the global C strings are copied into malloc()-ed memory.

Caught by the clang static analyzer.

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/20170622/265a84d7/attachment-0001.html>

More information about the webkit-unassigned mailing list