On Thu, 30 Jul 2015, Martin Storsjö wrote:

On Wed, 21 Jan 2015, Luca Barbato wrote:

On 21/01/15 14:41, Martin Storsjö wrote:
Allow $ as character anywhere within normal RTSP replies - both
within the lines, and as the first character of RTSP header lines.
(The existing old comment indicated that an inline packet could
start at any line within a RTSP reply header, but that doesn't
sound valid to me, and I'm not sure if the existing code
handled that correctly either.)
---
  libavformat/rtsp.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 2200f6e..947e88f 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1081,6 +1081,7 @@ int ff_rtsp_read_reply(AVFormatContext *s,
RTSPMessageHeader *reply,
      unsigned char ch;
      const char *p;
      int ret, content_length, line_count = 0, request = 0;
+    int first_line = 1;
      unsigned char *content = NULL;

  start:
@@ -1100,8 +1101,7 @@ start:
                  return AVERROR_EOF;
              if (ch == '\n')
                  break;
-            if (ch == '$') {
-                /* XXX: only parse it if first char on line ? */
+            if (ch == '$' && first_line && q == buf) {
                  if (return_on_interleaved_data) {
                      return 1;
                  } else
@@ -1112,6 +1112,7 @@ start:
              }
          }
          *q = '\0';
+        first_line = 0;

          av_dlog(s, "line='%s'\n", buf);



I'm fine with this restriction.

Even if the original reporter didn't get back to us with comments on whether these patches did help, I think this one should be fairly safe, and I've seen other reports relating to the same (https://bugzilla.gnome.org/show_bug.cgi?id=643812, https://trac.ffmpeg.org/ticket/4264), so I'll go ahead and push this one.

I got a confirmation now that this patch fixes an issue, so pushing, and adding CC: libav-sta...@libav.org.

// Martin
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to