[webkit-changes] [WebKit/WebKit] 34880c: [Cocoa] ImageDecoderAVFObjC::storeSampleBuffer can...

aestes noreply at github.com
Thu Aug 24 18:45:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 34880c26a151cfc9546a16b0575da05da2b59325
      https://github.com/WebKit/WebKit/commit/34880c26a151cfc9546a16b0575da05da2b59325
  Author: Andy Estes <aestes at apple.com>
  Date:   2023-08-24 (Thu, 24 Aug 2023)

  Changed paths:
    M Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm

  Log Message:
  -----------
  [Cocoa] ImageDecoderAVFObjC::storeSampleBuffer can leak a CGImage
https://bugs.webkit.org/show_bug.cgi?id=260681
rdar://114411564

Reviewed by Eric Carlson.

ImageDecoderAVFObjC::storeSampleBuffer creates a CGImage from a sample decoded from the passed-in
CMSampleBuffer, then sets its as that sample's image. However, if an iterator to the decoded sample
cannot be found in m_sampleData then the created CGImage would not be adopted and would therefore be
leaked.

Fixed this by moving the check of the sample iterator to before we create the CGImage. This prevents
us from early-returning prior to adopting the image, and has the side effect of avoiding the image
creation (and rotation) alltogether if there is no sample on which to attach it.

* Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:
(WebCore::ImageDecoderAVFObjC::storeSampleBuffer):

Canonical link: https://commits.webkit.org/267259@main




More information about the webkit-changes mailing list