summaryrefslogtreecommitdiff
path: root/libavformat/mpjpegdec.c
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2015-10-27 12:55:51 +0100
committerHendrik Leppkes <h.leppkes@gmail.com>2015-10-27 12:55:51 +0100
commitb95b8e5a2269f8fe6c137a5994b7d273545993d9 (patch)
tree90dcb26dc84c7f84e52ef83232b61eec669c54d3 /libavformat/mpjpegdec.c
parent7daac50067cbc3b6a4d677ac3f3574258659c2f6 (diff)
parent18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74 (diff)
downloadffmpeg-b95b8e5a2269f8fe6c137a5994b7d273545993d9.tar.gz
Merge commit '18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74'
* commit '18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74': mpjpeg: Cope with multipart lacking the initial CRLF Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat/mpjpegdec.c')
-rw-r--r--libavformat/mpjpegdec.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index d4b200e9c5..2749a48ace 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -153,10 +153,20 @@ static int parse_multipart_header(AVIOContext *pb, void *log_ctx)
int found_content_type = 0;
int ret, size = -1;
+ // get the CRLF as empty string
ret = get_line(pb, line, sizeof(line));
if (ret < 0)
return ret;
+ /* some implementation do not provide the required
+ * initial CRLF (see rfc1341 7.2.1)
+ */
+ if (!line[0]) {
+ ret = get_line(pb, line, sizeof(line));
+ if (ret < 0)
+ return ret;
+ }
+
if (strncmp(line, "--", 2))
return AVERROR_INVALIDDATA;
@@ -216,9 +226,6 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
if (ret < 0)
return ret;
- // trailing empty line
- avio_skip(s->pb, 2);
-
return 0;
}