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

Submitted by Ross Nicholson on Sept. 19, 2019, 3:12 p.m.

Details

Message ID 20190919151233.13784-1-phunkyfish@gmail.com
State Accepted
Commit 460f74495fa93c4bb85503c5443580e2bb857efa
Headers show

Commit Message

Ross Nicholson Sept. 19, 2019, 3:12 p.m.
---
 libavformat/rtsp.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Ross Nicholson Sept. 19, 2019, 3:14 p.m.
Updated to v4 of patch after learning from Aman Gupta that 'rt' did not
need to be checked in the context of this function.

Should be good to go now.

On Thu, 19 Sep 2019 at 16:12, 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..859defa592 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)
> +        return ENOTCONN;
> +
>      /* Add in RTSP headers */
>      out_buf = buf;
>      rt->seq++;
> --
> 2.20.1 (Apple Git-117)
>
>
Ross Nicholson Sept. 23, 2019, 3:17 p.m.
Can this be applied?

> On 19 Sep 2019, at 16:14, Ross Nicholson <phunkyfish@gmail.com> wrote:
> 
> Updated to v4 of patch after learning from Aman Gupta that 'rt' did not need to be checked in the context of this function.
> 
> Should be good to go now.
> 
>> On Thu, 19 Sep 2019 at 16:12, 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..859defa592 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)
>> +        return ENOTCONN;
>> +
>>      /* Add in RTSP headers */
>>      out_buf = buf;
>>      rt->seq++;
>> -- 
>> 2.20.1 (Apple Git-117)
>>
Aman Gupta Sept. 27, 2019, 5:55 p.m.
On Mon, Sep 23, 2019 at 8:23 AM Ross Nicholson <phunkyfish@gmail.com> wrote:

> Can this be applied?
>

Applied to master. Thank you for your contribution.


>
> > On 19 Sep 2019, at 16:14, Ross Nicholson <phunkyfish@gmail.com> wrote:
> >
> > Updated to v4 of patch after learning from Aman Gupta that 'rt' did not
> need to be checked in the context of this function.
> >
> > Should be good to go now.
> >
> >> On Thu, 19 Sep 2019 at 16:12, 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..859defa592 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)
> >> +        return ENOTCONN;
> >> +
> >>      /* Add in RTSP headers */
> >>      out_buf = buf;
> >>      rt->seq++;
> >> --
> >> 2.20.1 (Apple Git-117)
> >>
> _______________________________________________
> 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..859defa592 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)
+        return ENOTCONN;
+
     /* Add in RTSP headers */
     out_buf = buf;
     rt->seq++;