summaryrefslogtreecommitdiff
path: root/libavformat/mpjpegdec.c
diff options
context:
space:
mode:
authorAlex Agranovsky <alex@sighthound.com>2015-09-12 19:04:26 -0400
committerMichael Niedermayer <michael@niedermayer.cc>2015-09-21 02:30:29 +0200
commit53e8bef25a78457e4339e353568004f03b8a2396 (patch)
tree7dffbc150cf0984bf570daaa05a14a995e1f0c2e /libavformat/mpjpegdec.c
parent01770bfda02a72dc4c721e5cbd66ffa47b37002d (diff)
mpjpeg: CRLF terminating a sequence of MIME headers should not cause an error
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/mpjpegdec.c')
-rw-r--r--libavformat/mpjpegdec.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index 4b57fad9ae..c76ea560e7 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -56,11 +56,20 @@ static void trim_right(char* p)
static int split_tag_value(char **tag, char **value, char *line)
{
char *p = line;
+ int foundData = 0;
- while (*p != '\0' && *p != ':')
+ *tag = NULL;
+ *value = NULL;
+
+
+ while (*p != '\0' && *p != ':') {
+ if (!av_isspace(*p)) {
+ foundData = 1;
+ }
p++;
+ }
if (*p != ':')
- return AVERROR_INVALIDDATA;
+ return foundData ? AVERROR_INVALIDDATA : 0;
*p = '\0';
*tag = line;
@@ -167,6 +176,8 @@ static int parse_multipart_header(AVIOContext *pb, void *log_ctx)
ret = split_tag_value(&tag, &value, line);
if (ret < 0)
return ret;
+ if (value==NULL || tag==NULL)
+ break;
if (!av_strcasecmp(tag, "Content-type")) {
if (av_strcasecmp(value, "image/jpeg")) {