Skip to content

Commit

Permalink
Merge commit '18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74'
Browse files Browse the repository at this point in the history
* commit '18f9308e6a96bbeb034ee5213a6d41e0b6c2ae74':
  mpjpeg: Cope with multipart lacking the initial CRLF

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
  • Loading branch information
Nevcairiel committed Oct 27, 2015
2 parents 7daac50 + 18f9308 commit b95b8e5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libavformat/mpjpegdec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit b95b8e5

Please sign in to comment.