[FFmpeg-devel,2/2] avformat/mpjpegdec: fix strict boundary search string

Submitted by Moritz Barsnick on May 26, 2019, 8:44 p.m.

Details

Message ID 20190526204400.27482-1-barsnick@gmx.net
State New
Headers show

Commit Message

Moritz Barsnick May 26, 2019, 8:44 p.m.
According to RFC1341, the multipart boundary indicated by the
Content-Type header must be prepended by CRLF + "--", and followed
by CRLF. In the case of strict MIME header boundary handling, the
"--" was forgotten to add.

Fixes trac #7921.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
---
 libavformat/mpjpegdec.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

--
2.20.1

Comments

Moritz Barsnick May 26, 2019, 8:46 p.m.
On Sun, May 26, 2019 at 22:44:00 +0200, Moritz Barsnick wrote:
> Subject: [FFmpeg-devel] [PATCH 2/2] avformat/mpjpegdec: fix strict boundary search string

D'uh, I told git send-email that the subject should contain "V2". I
wonder why that gets ignored.

Moritz

Patch hide | download patch | download mbox

diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index a23469c0ec..f8741cc3b0 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -306,8 +306,9 @@  static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
             boundary = mpjpeg_get_boundary(s->pb);
         }
         if (boundary != NULL) {
-            mpjpeg->boundary = boundary;
-            mpjpeg->searchstr = av_asprintf( "\r\n%s\r\n", boundary );
+            mpjpeg->boundary = av_asprintf("--%s", boundary);
+            mpjpeg->searchstr = av_asprintf("\r\n--%s\r\n", boundary);
+            av_freep(&boundary);
         } else {
             mpjpeg->boundary = av_strdup("--");
             mpjpeg->searchstr = av_strdup("\r\n--");