From 38c543ac8ec376a91f0f313697565d31f02b20b5 Mon Sep 17 00:00:00 2001 From: Hendrik Leppkes Date: Fri, 26 Sep 2014 13:43:59 +0200 Subject: Another sanity check to avoid crashing on bad renderers --- decoder/LAVVideo/LAVVideo.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'decoder') diff --git a/decoder/LAVVideo/LAVVideo.cpp b/decoder/LAVVideo/LAVVideo.cpp index 8abd20d2..a6e194c9 100644 --- a/decoder/LAVVideo/LAVVideo.cpp +++ b/decoder/LAVVideo/LAVVideo.cpp @@ -849,6 +849,15 @@ HRESULT CLAVVideo::GetDeliveryBuffer(IMediaSample** ppOut, int width, int height DbgLog((LOG_TRACE, 10, L"-> Width changed from %d to %d (target: %d)", pBMIOld->biWidth, pBMINew->biWidth, rcTarget.right)); #endif + if (pBMINew->biWidth < width) { + DbgLog((LOG_TRACE, 10, L" -> Renderer is trying to shrink the output window, failing!")); + (*ppOut)->Release(); + (*ppOut) = nullptr; + DeleteMediaType(pmt); + return E_FAIL; + } + + if (pmt->formattype == FORMAT_VideoInfo2 && outMt.formattype == FORMAT_VideoInfo2 && m_bDXVAExtFormatSupport) { VIDEOINFOHEADER2 *vih2Current = (VIDEOINFOHEADER2 *)outMt.pbFormat; VIDEOINFOHEADER2 *vih2New = (VIDEOINFOHEADER2 *)pmt->pbFormat; -- cgit v1.2.3