diff options
author | Limin Wang <lance.lmwang@gmail.com> | 2021-12-06 10:37:08 +0800 |
---|---|---|
committer | Limin Wang <lance.lmwang@gmail.com> | 2021-12-07 20:33:17 +0800 |
commit | 6d42af02f566c2a14a72bc13517add071c1d2a2b (patch) | |
tree | b1ba567a303720c45d1f553e42bc28068882dee6 /libavformat/rtsp.c | |
parent | f210766a55ea2db85b01038e0f4a4b8891d1903b (diff) | |
download | ffmpeg-6d42af02f566c2a14a72bc13517add071c1d2a2b.tar.gz |
avformat/rtsp: add error code handling for ff_rtsp_skip_packet()
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
Diffstat (limited to 'libavformat/rtsp.c')
-rw-r--r-- | libavformat/rtsp.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 5cffe0b6b5..bf25429187 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -1145,7 +1145,7 @@ void ff_rtsp_parse_line(AVFormatContext *s, } /* skip a RTP/TCP interleaved packet */ -void ff_rtsp_skip_packet(AVFormatContext *s) +int ff_rtsp_skip_packet(AVFormatContext *s) { RTSPState *rt = s->priv_data; int ret, len, len1; @@ -1153,7 +1153,7 @@ void ff_rtsp_skip_packet(AVFormatContext *s) ret = ffurl_read_complete(rt->rtsp_hd, buf, 3); if (ret != 3) - return; + return ret < 0 ? ret : AVERROR(EIO); len = AV_RB16(buf + 1); av_log(s, AV_LOG_TRACE, "skipping RTP packet len=%d\n", len); @@ -1165,9 +1165,11 @@ void ff_rtsp_skip_packet(AVFormatContext *s) len1 = sizeof(buf); ret = ffurl_read_complete(rt->rtsp_hd, buf, len1); if (ret != len1) - return; + return ret < 0 ? ret : AVERROR(EIO); len -= len1; } + + return 0; } int ff_rtsp_read_reply(AVFormatContext *s, RTSPMessageHeader *reply, @@ -1201,8 +1203,11 @@ start: if (ch == '$' && q == buf) { if (return_on_interleaved_data) { return 1; - } else - ff_rtsp_skip_packet(s); + } else { + ret = ff_rtsp_skip_packet(s); + if (ret < 0) + return ret; + } } else if (ch != '\r') { if ((q - buf) < sizeof(buf) - 1) *q++ = ch; |