[FFmpeg-devel,v2] libavformat/rtsp: return error if rtsp_hd_out is null instead of crash

Submitted by Ross Nicholson on Sept. 18, 2019, 6:54 a.m.

Details

Message ID 20190918065427.11817-1-phunkyfish@gmail.com
State New
Headers show

Commit Message

Ross Nicholson Sept. 18, 2019, 6:54 a.m.
---
 libavformat/rtsp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ross Nicholson Sept. 18, 2019, 6:55 a.m.
Updated patch to add return after variable definitions.

On Wed, 18 Sep 2019 at 07:54, phunkyfish <phunkyfish@gmail.com> wrote:

> ---
>  libavformat/rtsp.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
> index c153cac88b..3e8606dade 100644
> --- a/libavformat/rtsp.c
> +++ b/libavformat/rtsp.c
> @@ -1318,6 +1318,9 @@ static int
> rtsp_send_cmd_with_content_async(AVFormatContext *s,
>      char buf[4096], *out_buf;
>      char base64buf[AV_BASE64_SIZE(sizeof(buf))];
>
> +    if (rt->rtsp_hd_out == NULL)
> +        return ENOTCONN;
> +
>      /* Add in RTSP headers */
>      out_buf = buf;
>      rt->seq++;
> --
> 2.20.1 (Apple Git-117)
>
>
Michael Niedermayer Sept. 18, 2019, 8:14 p.m.
On Wed, Sep 18, 2019 at 07:54:27AM +0100, phunkyfish wrote:
> ---
>  libavformat/rtsp.c | 3 +++
>  1 file changed, 3 insertions(+)

The Author lacks your name
"From: phunkyfish <phunkyfish@gmail.com>"

is that intended ?

[...]
Ross Nicholson Sept. 18, 2019, 8:30 p.m.
Sorry, my name is Ross Nicholson. But the alias is fine too.

> On 18 Sep 2019, at 21:14, Michael Niedermayer <michael@niedermayer.cc> wrote:
> 
>> On Wed, Sep 18, 2019 at 07:54:27AM +0100, phunkyfish wrote:
>> ---
>> libavformat/rtsp.c | 3 +++
>> 1 file changed, 3 insertions(+)
> 
> The Author lacks your name
> "From: phunkyfish <phunkyfish@gmail.com>"
> 
> is that intended ?
> 
> [...]
> 
> -- 
> Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
> 
> While the State exists there can be no freedom; when there is freedom there
> will be no State. -- Vladimir Lenin
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Patch hide | download patch | download mbox

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c153cac88b..3e8606dade 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1318,6 +1318,9 @@  static int rtsp_send_cmd_with_content_async(AVFormatContext *s,
     char buf[4096], *out_buf;
     char base64buf[AV_BASE64_SIZE(sizeof(buf))];
 
+    if (rt->rtsp_hd_out == NULL)
+        return ENOTCONN;
+
     /* Add in RTSP headers */
     out_buf = buf;
     rt->seq++;