aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/msnwc_tcp.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-11-10 17:54:06 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2015-11-10 17:54:06 +0100
commit2e82d51714c74a20bd5e3440836c16d608e3df7a (patch)
tree8909ccab6477f3a305a7dd4179fbf7cf883a4161 /libavformat/msnwc_tcp.c
parent8600fef123bf00403c8d591c5345ed03b683572d (diff)
parent4dfbc7a7559ccab666a8fd39de4224eb4b02c768 (diff)
downloadffmpeg-2e82d51714c74a20bd5e3440836c16d608e3df7a.tar.gz
Merge commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768'
* commit '4dfbc7a7559ccab666a8fd39de4224eb4b02c768': msnwc_tcp: Correctly report failure Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat/msnwc_tcp.c')
-rw-r--r--libavformat/msnwc_tcp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/libavformat/msnwc_tcp.c b/libavformat/msnwc_tcp.c
index 2ec18fb554..e79f9a8a45 100644
--- a/libavformat/msnwc_tcp.c
+++ b/libavformat/msnwc_tcp.c
@@ -104,6 +104,7 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
AVIOContext *pb = ctx->pb;
uint16_t keyframe;
uint32_t size, timestamp;
+ int ret;
avio_skip(pb, 1); /* one byte has been read ahead */
avio_skip(pb, 2);
@@ -114,8 +115,11 @@ static int msnwc_tcp_read_packet(AVFormatContext *ctx, AVPacket *pkt)
avio_skip(pb, 4);
timestamp = avio_rl32(pb);
- if(!size || av_get_packet(pb, pkt, size) != size)
- return -1;
+ if (!size)
+ return AVERROR_INVALIDDATA;
+
+ if ((ret = av_get_packet(pb, pkt, size)) < 0)
+ return ret;
avio_skip(pb, 1); /* Read ahead one byte of struct size like read_header */