DirectShow filter does not connect to the downstream filter on Windows 8 and Windows 7 SP1 with KB 2670838
This article helps you resolve the problem where the DirectShow filter will not connect to the downstream filter after you install KB 2670838 on Windows 8 or Windows 7 SP1.
Original product version: Windows 8, Windows 7
Original KB number: 2841589
You are using a DirectShow filter that does not connect to a downstream filter on Windows 8 and Windows 7 SP1 after installing KB 2670838. Before installing KB 2670838, this problem did not occur on Windows 7 SP1.
When calling the
CBasePin.ReceiveConnection function, the value that is returned is
New checks for video media types have been added to the DirectShow base class on Windows 8. These checks may reject incorrect or unknown media types. These checks are added to protect systems from buffer overflows and buffer overruns exploitation.
The following are recommendations that can help ensure your code passes the new security checks:
AM_MEDIA_TYPEstructure for invalid values. This structure describes the format of a media sample.
CMediaType.AllocFormatBufferto allocate memory for the format block, make sure you are passing correct size required for the format block.
this method updates the
pbFormatmembers of the
BITMAPINFOHEADERstructure for invalid values.
biSizeis equal to
biSizeImagefor bad value (that is, > 0x40000000).
biClrUsedfor bad value (that is, > 256).
Steps to reproduce the problem using GraphEdit
GraphEdit is available in the Microsoft Windows Software Development Kit (SDK).
Go to Bin folder of the Windows SDK and run graphedt.exe.
From the Graph menu, click Insert Filters. A dialog box appears with a list of the filters on your system, organized by filter category.
Find your filter under the appropriate category (found under DirectShow Filters category) and click on Insert Filter button. If your filter is not a source filter, then make sure you have added required source filter for it.
Insert the required downstream filter.
After you have added the filters, you can connect two filters by dragging the mouse from one filter's output pin to another filter's input pin. If the pins accept the connection, GraphEdit draws an arrow connecting them. Try this for your filter with the downstream filter. You will see
- Input pin and output pin will connect without any error on Windows 7 SP1.
- GraphEdit will show you error message on Windows 8 and Windows 7 SP1 with KB 2670838 installed. Terms used in this article:
Terms that are used in this article:
A buffer overflow occurs when we try to fit more data into a buffer than was allocated. A buffer overflow can be used to execute malicious code in a system.
A buffer overrun is caused by treating unchecked, external input as trustworthy data. The act of copying this data, using operations such as
wcscpy, can create unanticipated results, which allows for system corruption.