]> git.sesse.net Git - ffmpeg/commitdiff
avformat/ftp: Solve a crash bug when network occur a exception
authortiejun.peng@foxmail.com <tiejun.peng@foxmail.com>
Tue, 4 Apr 2017 14:12:19 +0000 (22:12 +0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 5 Apr 2017 21:57:08 +0000 (23:57 +0200)
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>
libavformat/ftp.c

index 0663b47bc49efb0ce3d00004d4617a37e6a82d51..9aa7a45629ff6e67e6d65672bc7a6394bf2034a9 100644 (file)
@@ -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)