Bug 301482
| Summary: | Null deref in CMUtilities' toCMSampleBuffer | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Component: | Media | Assignee: | Jean-Yves Avenard [:jya] <jean-yves.avenard> |
| Status: | RESOLVED FIXED | ||
| Severity: | Normal | CC: | webkit-bug-importer |
| Priority: | P2 | Keywords: | InRadar |
| Version: | WebKit Nightly Build | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
Jean-Yves Avenard [:jya]
Last minute change introduced a null dereference if the sample doesn't contain any attachment.
```
RetainPtr attachmentsArray = PAL::CMSampleBufferGetSampleAttachmentsArray(rawSampleBuffer, false);
if (!attachmentsArray || static_cast<size_t>(CFArrayGetCount(attachmentsArray.get())) < samples.size()) {
RELEASE_LOG_DEBUG(Media, "Encrypted sample doesn't contain sufficient attachments: %u (expected:%u)", static_cast<unsigned>(CFArrayGetCount(attachmentsArray.get()), static_cast<unsigned>(samples.size()));
return adoptCF(rawSampleBuffer);
}
```
if `attachmentsArray` is null, CFArrayGetCount will cause a dereference of 0.
| Attachments | ||
|---|---|---|
| Add attachment proposed patch, testcase, etc. |
Radar WebKit Bug Importer
<rdar://problem/163432969>
Jean-Yves Avenard [:jya]
Pull request: https://github.com/WebKit/WebKit/pull/53008
EWS
Committed 302168@main (f12eb6a08e4b): <https://commits.webkit.org/302168@main>
Reviewed commits have been landed. Closing PR #53008 and removing active labels.