Zebediah Figura : winegstreamer: Handle zero-length reads in src_getrange_cb().
Alexandre Julliard
julliard at winehq.org
Wed Oct 6 15:51:39 CDT 2021
Module: wine
Branch: master
Commit: 8e9d7b031f7b0c93471cfbffe8f720c34623a273
URL: https://source.winehq.org/git/wine.git/?a=commit;h=8e9d7b031f7b0c93471cfbffe8f720c34623a273
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Wed Oct 6 11:46:32 2021 -0500
winegstreamer: Handle zero-length reads in src_getrange_cb().
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/winegstreamer/wg_parser.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/dlls/winegstreamer/wg_parser.c b/dlls/winegstreamer/wg_parser.c
index 72dfab8f3d6..9a382cb724c 100644
--- a/dlls/winegstreamer/wg_parser.c
+++ b/dlls/winegstreamer/wg_parser.c
@@ -1272,7 +1272,7 @@ static GstFlowReturn src_getrange_cb(GstPad *pad, GstObject *parent,
GstMapInfo map_info;
bool ret;
- GST_LOG("pad %p, offset %" G_GINT64_MODIFIER "u, length %u, buffer %p.", pad, offset, size, *buffer);
+ GST_LOG("pad %p, offset %" G_GINT64_MODIFIER "u, size %u, buffer %p.", pad, offset, size, *buffer);
if (offset == GST_BUFFER_OFFSET_NONE)
offset = parser->next_pull_offset;
@@ -1281,6 +1281,16 @@ static GstFlowReturn src_getrange_cb(GstPad *pad, GstObject *parent,
if (!*buffer)
*buffer = new_buffer = gst_buffer_new_and_alloc(size);
+ if (!size)
+ {
+ /* asfreader occasionally asks for zero bytes. gst_buffer_map() will
+ * return NULL in this case. Avoid confusing the read thread by asking
+ * it for zero bytes. */
+ gst_buffer_set_size(*buffer, 0);
+ GST_LOG("Returning empty buffer.");
+ return GST_FLOW_OK;
+ }
+
gst_buffer_map(*buffer, &map_info, GST_MAP_WRITE);
pthread_mutex_lock(&parser->mutex);
More information about the wine-cvs
mailing list