[vlc-commits] demux/avformat: fix return-value of IORead (fixes #17574)
Filip Roséen
git at videolan.org
Tue Nov 1 22:18:23 CET 2016
vlc | branch: master | Filip Roséen <filip at atch.se> | Tue Nov 1 13:51:27 2016 +0100| [83b66b77d146046aa42b9406b979f14fe4eb91c9] | committer: Rémi Denis-Courmont
demux/avformat: fix return-value of IORead (fixes #17574)
av_read_frame expects 0 to be returned on end-of-file, and negative
values are reserved for fatal stream-errors. The previous
implementation would return -1 upon EOF (vlc_stream_Read returning 0),
causing premature EOF from modules/demux/avformat/demux.c:Demux.
These changes make sure that we honor the contract associated with the
read-callback, and that we only return -1 if there is a fatal error.
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=83b66b77d146046aa42b9406b979f14fe4eb91c9
---
modules/demux/avformat/demux.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index f962862..4f81ad8 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -1119,7 +1119,7 @@ static int IORead( void *opaque, uint8_t *buf, int buf_size )
demux_t *p_demux = opaque;
if( buf_size < 0 ) return -1;
int i_ret = vlc_stream_Read( p_demux->s, buf, buf_size );
- return i_ret ? i_ret : -1;
+ return i_ret >= 0 ? i_ret : -1;
}
static int64_t IOSeek( void *opaque, int64_t offset, int whence )
More information about the vlc-commits
mailing list