mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 13:11:06 +00:00
ksdeviceprovider: Fix crash while probing device caps
Ignore unexpected media type reported by driver, instead of abort Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6081>
This commit is contained in:
parent
a1cbe351ec
commit
b4ee86d1e7
1 changed files with 13 additions and 2 deletions
|
@ -531,9 +531,20 @@ ks_video_probe_filter_for_caps (HANDLE filter_handle)
|
||||||
entry = NULL;
|
entry = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry != NULL) {
|
/* XXX: We've been doing g_assert (entry->sample_size != 0)
|
||||||
g_assert (entry->sample_size != 0);
|
* since more than 10 years ago, but it's quite questionable.
|
||||||
|
* According to MS documentation,
|
||||||
|
* SampleSize field in KSDATARANGE struct is ignored,
|
||||||
|
* and biSizeImage in KS_BITMAPINFOHEADER is required only if
|
||||||
|
* compression is used. (driver maybe set zero for raw image).
|
||||||
|
* But since we've expected the value shouldn't be zero,
|
||||||
|
* let's ignore a media type with entry->sample_size == 0 for now.
|
||||||
|
* Actually people should not use this plugin in newly written code
|
||||||
|
* anymore */
|
||||||
|
if (entry && entry->sample_size == 0)
|
||||||
|
g_clear_pointer (&entry, ks_video_media_type_free);
|
||||||
|
|
||||||
|
if (entry != NULL) {
|
||||||
if (src_vscc != NULL) {
|
if (src_vscc != NULL) {
|
||||||
memcpy ((gpointer) & entry->vscc, src_vscc,
|
memcpy ((gpointer) & entry->vscc, src_vscc,
|
||||||
sizeof (entry->vscc));
|
sizeof (entry->vscc));
|
||||||
|
|
Loading…
Reference in a new issue