From 3efb72de5aca01d3d979ce697728e51bc3e99901 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Wed, 6 Oct 2021 11:46:35 -0500 Subject: [PATCH] winegstreamer: Avoid seeking past the end of an IMFByteStream. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51837 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/winegstreamer/media_source.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/dlls/winegstreamer/media_source.c b/dlls/winegstreamer/media_source.c index dab85e4689d..6ecd345cb73 100644 --- a/dlls/winegstreamer/media_source.c +++ b/dlls/winegstreamer/media_source.c @@ -639,6 +639,14 @@ static DWORD CALLBACK read_thread(void *arg) else if (offset + size >= file_size) size = file_size - offset; + /* Some IMFByteStreams (including the standard file-based stream) return + * an error when reading past the file size. */ + if (!size) + { + wg_parser_push_data(source->wg_parser, data, 0); + continue; + } + if (!array_reserve(&data, &buffer_size, size, 1)) { free(data);