summaryrefslogtreecommitdiff
path: root/libavformat/ftp.c
diff options
context:
space:
mode:
authortiejun.peng@foxmail.com <tiejun.peng@foxmail.com>2017-04-04 22:12:19 +0800
committerMichael Niedermayer <michael@niedermayer.cc>2017-04-05 23:57:08 +0200
commit9fe73b0147d329bb03ea57c201dc99317cbf3c29 (patch)
tree2f6937192190dff34d8ede3dfd77d71287f5a422 /libavformat/ftp.c
parentb02027c79d4b504fccc948c9de17ef65253b81b6 (diff)
downloadffmpeg-9fe73b0147d329bb03ea57c201dc99317cbf3c29.tar.gz
avformat/ftp: Solve a crash bug when network occur a exception
This fixes a proble where ffmpeg would cause crash to do a seek when the network disconnect. The log like this: 01-01 10:53:03.441 6580 6580 F DEBUG : backtrace: 01-01 10:53:03.441 6580 6580 F DEBUG : #00 pc 0002942e /system/lib/libavformat.so (ffurl_write+9) Signed-off-by: tiejun.peng <tiejun.peng@foxmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/ftp.c')
-rw-r--r--libavformat/ftp.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/ftp.c b/libavformat/ftp.c
index 0663b47bc4..9aa7a45629 100644
--- a/libavformat/ftp.c
+++ b/libavformat/ftp.c
@@ -206,6 +206,9 @@ static int ftp_send_command(FTPContext *s, const char *command,
if (response)
*response = NULL;
+ if (!s->conn_control)
+ return AVERROR(EIO);
+
if ((err = ffurl_write(s->conn_control, command, strlen(command))) < 0)
return err;
if (!err)