Bug 312411
| Summary: | Fix leaks from Security APIs by using adoptCF() for CFErrorRef out parameters | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | David Kilzer (:ddkilzer) <ddkilzer> |
| Component: | WebKit Misc. | Assignee: | David Kilzer (:ddkilzer) <ddkilzer> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
David Kilzer (:ddkilzer)
Several Security framework APIs (`SecTrustSerialize`, `SecTrustDeserialize`, `SecTrustCopyPropertyListRepresentation`, `SecTrustCreateFromPropertyListRepresentation`, `SecKeyCreateRandomKey`, `SecKeyCreateWithData`) return +1 retained `CFErrorRef` objects through their out parameters, but the APIs are missing the `CF_RETURNS_RETAINED` annotation on those parameters (rdar://161546781). Newer functions in the same headers (`SecTrustCopyTrustStoreContentDigest`, `SecTrustGetAssetVersionNumber`, etc.) already have the annotation, but these older APIs have not been updated.
WebKit callers store the raw `CFErrorRef` in a local variable, check it for errors, but never release it -- leaking the error object on every error path. This affects both production code (`CoreIPCSecTrust.mm`, `WKRemoteObjectCoder.mm`, `VirtualAuthenticatorUtils.mm`) and test code (`IPCSerialization.mm`, `Challenge.mm`, `WebTransport.mm`, `_WKWebAuthenticationPanel.mm`, `TestControllerCocoa.mm`).
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/174864243>
David Kilzer (:ddkilzer)
Pull request: https://github.com/WebKit/WebKit/pull/62860
EWS
Committed 311454@main (12b5e059d376): <https://commits.webkit.org/311454@main>
Reviewed commits have been landed. Closing PR #62860 and removing active labels.
EWS
Committed 305413.773@safari-7624-branch (ffded96c95cd): <https://commits.webkit.org/305413.773@safari-7624-branch>
Reviewed commits have been landed. Closing PR #5126 and removing active labels.