Skip to content

Commit

Permalink
Fix bug in MediaFormatReader::copyTrackArray() found by new libcpp as…
Browse files Browse the repository at this point in the history
…sertions

https://bugs.webkit.org/show_bug.cgi?id=251617
rdar://104967552

Reviewed by Andy Estes and Jer Noble.

Dont dereference `m_parseTracksStatus` if the action was aborted, since
m_parseTracksStatus will be std::nullopt in this case.

* Source/WebKit/Shared/mac/MediaFormatReader/MediaFormatReader.cpp:
(WebKit::MediaFormatReader::copyTrackArray):

Canonical link: https://commits.webkit.org/259794@main
  • Loading branch information
cdumez committed Feb 3, 2023
1 parent 319370e commit d7a2a70
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions Source/WebCore/PAL/pal/spi/cocoa/MediaToolboxSPI.h
Expand Up @@ -42,6 +42,7 @@
enum {
kMTPluginFormatReaderError_AllocationFailure = -16501,
kMTPluginFormatReaderError_ParsingFailure = -16503,
kMTPluginFormatReaderError_InternalFailure = -16504,
kMTPluginSampleCursorError_NoSamples = -16507,
kMTPluginSampleCursorError_LocationNotAvailable = -16508,
kMTPluginByteSourceError_EndOfStream = -16511,
Expand Down
@@ -1,4 +1,4 @@
/*
/*
* Copyright (C) 2020-2022 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand Down Expand Up @@ -279,6 +279,9 @@ OSStatus MediaFormatReader::copyTrackArray(CFArrayRef* trackArrayCopy)
return m_parseTracksStatus.has_value() || action.aborted();
});

if (action.aborted())
return kMTPluginFormatReaderError_InternalFailure;

if (*m_parseTracksStatus != noErr)
return *m_parseTracksStatus;

Expand Down

0 comments on commit d7a2a70

Please sign in to comment.