[1/5] rtmpproto: Check the return from ff_amf_read_string

Message ID 20161014133843.11941-1-martin@martin.st
State Committed
Commit 7395784ba72742b6daa62d35db4028e09f3fdf06
Headers show

Commit Message

Martin Storsjö Oct. 14, 2016, 1:38 p.m.
If this failed, we used to continue with an uninitialized
filename buffer.

CC: libav-stable@libav.org
---
 libavformat/rtmpproto.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Luca Barbato Oct. 14, 2016, 3:03 p.m. | #1
Set Ok.

Maybe could land in release/12 as well.

lu
Martin Storsjö Oct. 14, 2016, 5:56 p.m. | #2
On Fri, 14 Oct 2016, Luca Barbato wrote:

> Set Ok.
>
> Maybe could land in release/12 as well.

Yep, 1-3 or 1-4 can probably go in right away. For patch 5, I'd prefer to 
have it only in master first for a little while, and if we don't hear 
anything bad about it, it can be backported to release branches later.

// Martin

Patch

diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c
index e7e2479..6402425 100644
--- a/libavformat/rtmpproto.c
+++ b/libavformat/rtmpproto.c
@@ -1918,6 +1918,13 @@  static int send_invoke_response(URLContext *s, RTMPPacket *pkt)
         !strcmp(command, "publish")) {
         ret = ff_amf_read_string(&gbc, filename,
                                  sizeof(filename), &stringlen);
+        if (ret) {
+            if (ret == AVERROR(EINVAL))
+                av_log(s, AV_LOG_ERROR, "Unable to parse stream name - name too long?\n");
+            else
+                av_log(s, AV_LOG_ERROR, "Unable to parse stream name\n");
+            return ret;
+        }
         // check with url
         if (s->filename) {
             pchar = strrchr(s->filename, '/');