mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-11-21 10:55:51 +02:00
mpjpeg: Cope with multipart lacking the initial CRLF
Some server in the wild do not put the boundary at a newline as rfc1347 7.2.1 states. Cope with that by reading a line and if it is not empty reading a second one. Reported-By: bitingsock
This commit is contained in:
parent
22f4d9c303
commit
18f9308e6a
@ -153,10 +153,20 @@ static int parse_multipart_header(AVFormatContext *s)
|
|||||||
int found_content_type = 0;
|
int found_content_type = 0;
|
||||||
int ret, size = -1;
|
int ret, size = -1;
|
||||||
|
|
||||||
|
// get the CRLF as empty string
|
||||||
ret = get_line(s->pb, line, sizeof(line));
|
ret = get_line(s->pb, line, sizeof(line));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
/* some implementation do not provide the required
|
||||||
|
* initial CRLF (see rfc1341 7.2.1)
|
||||||
|
*/
|
||||||
|
if (!line[0]) {
|
||||||
|
ret = get_line(s->pb, line, sizeof(line));
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (strncmp(line, "--", 2))
|
if (strncmp(line, "--", 2))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
|
|
||||||
@ -208,9 +218,6 @@ static int mpjpeg_read_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
// trailing empty line
|
|
||||||
avio_skip(s->pb, 2);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user