From: Alex Agranovsky <[email protected]>

Signed-off-by: Michael Niedermayer <[email protected]>
---
 libavformat/mpjpegdec.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavformat/mpjpegdec.c b/libavformat/mpjpegdec.c
index ed98d6f..8072bd5 100644
--- a/libavformat/mpjpegdec.c
+++ b/libavformat/mpjpegdec.c
@@ -43,11 +43,20 @@ static int get_line(AVIOContext *pb, char *line, int 
line_size)
 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;
@@ -177,6 +186,8 @@ static int parse_multipart_header(AVFormatContext *s)
         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")) {
-- 
1.9.5 (Apple Git-50.3)

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to