From 6f6dfc5163c3e1442f1c480e3dbd645ecd740eb5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 19 Nov 2012 00:28:38 +0100 Subject: [PATCH] mplayer: fix potential issue when ao_play() fails ao_play() can fail; in that case a negative error code is returned. This error code is returned by write_to_ao() in turn. The function fill_audio_out_buffers(), which calls write_to_ao(), doesn't check for any error codes, and will likely trigger the assertion following the function call. Change write_to_ao() to return 0 on failure to hopefully prevent crashes when AOs fail. --- core/mplayer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/mplayer.c b/core/mplayer.c index ebe52b1b76..1b07a0f9ee 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -2076,8 +2076,9 @@ static int write_to_ao(struct MPContext *mpctx, void *data, int len, int flags, // Keep correct pts for remaining data - could be used to flush // remaining buffer when closing ao. ao->pts += played / bps; + return played; } - return played; + return 0; } #define ASYNC_PLAY_DONE -3