From b16830840eb9bdec88fce2aebb38a582e093ab6b Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sun, 27 Jan 2013 04:53:03 +0100
Subject: [PATCH] tiff: in add_string_metadata() check the count more
 completely

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavcodec/tiff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c
index d5fba7ea6f9..fdcd9374a1a 100644
--- a/libavcodec/tiff.c
+++ b/libavcodec/tiff.c
@@ -308,7 +308,7 @@ static int add_string_metadata(int count, const char *name,
 {
     char *value;
 
-    if (bytestream2_get_bytes_left(&s->gb) < count)
+    if (bytestream2_get_bytes_left(&s->gb) < count || count < 0)
         return AVERROR_INVALIDDATA;
 
     value = av_malloc(count + 1);
-- 
GitLab