avformat/hdsenc: fix off by 1 error in array size check
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Dec 2013 19:17:23 +0000 (20:17 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 11 Dec 2013 19:23:31 +0000 (20:23 +0100)
Fixes CID1135763, CID1135764

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/hdsenc.c

index 7569b8f..6679a17 100644 (file)
@@ -89,7 +89,7 @@ static int parse_header(OutputStream *os, const uint8_t *buf, int buf_size)
         if (size > buf_size)
             return AVERROR_INVALIDDATA;
         if (type == 8 || type == 9) {
-            if (os->nb_extra_packets > FF_ARRAY_ELEMS(os->extra_packets))
+            if (os->nb_extra_packets >= FF_ARRAY_ELEMS(os->extra_packets))
                 return AVERROR_INVALIDDATA;
             os->extra_packet_sizes[os->nb_extra_packets] = size;
             os->extra_packets[os->nb_extra_packets] = av_malloc(size);