[FFmpeg-trac] #7921(avformat:new): "-strict_mime_boundary 1" searches for incorrect boundary
FFmpeg
trac at avcodec.org
Thu May 23 18:52:23 EEST 2019
#7921: "-strict_mime_boundary 1" searches for incorrect boundary
-------------------------------------+------------------------------------
Reporter: barsnick | Owner:
Type: defect | Status: new
Priority: normal | Component: avformat
Version: unspecified | Resolution:
Keywords: mpjpegdec | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+------------------------------------
Comment (by barsnick):
Root cause:
The boundary parameter string found in the Content-Type header is not
prepended with {{{"--"}}}. The exact match string {{{mpjpeg->boundary}}}
is taken is taken directly from the parsing of the header; the precise
binary match string {{{mpjpeg->searchstr}}} is also created from the
parsing, with additional {{{"\r\n"}}} added before and after.
RFC1341 says:
The Content-Type field for multipart entities requires one parameter,
"boundary", which is used to specify the encapsulation boundary. The
encapsulation boundary is defined as a line consisting entirely of two
hyphen characters ("-", decimal code 45) followed by the boundary
parameter value from the Content-Type header field.
[...]
Note that the encapsulation boundary must occur at the beginning of a
line, i.e., following a CRLF, and that that initial CRLF is considered to
be part of the encapsulation boundary rather than part of the preceding
part. The boundary must be followed immediately either by another CRLF and
the header fields for the next part, [...]
In other words, the boundary found in the header's parameter shall be
encapsulated as:
{{{"\r\n" + "--" + boundary from header + "\r\n"}}}
What mpjpegdec does is to only encapsulate it with {{{"\r\n"}}}:
https://github.com/FFmpeg/FFmpeg/blob/b401a4ab8aa85c536bd9eee0da8f51551b66c70e/libavformat/mpjpegdec.c#L309
--
Ticket URL: <https://trac.ffmpeg.org/ticket/7921#comment:1>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list