[libav-commits] hdsenc: Fix an off by one error in an array size check

Michael Niedermayer git at libav.org
Sat Dec 14 16:51:49 CET 2013


Module: libav
Branch: master
Commit: b8ed15d6378f00e158c72c526fa0fce17da77361

Author:    Michael Niedermayer <michaelni at gmx.at>
Committer: Martin Storsjö <martin at martin.st>
Date:      Wed Dec 11 20:17:23 2013 +0100

hdsenc: Fix an off by one error in an array size check

Signed-off-by: Martin Storsjö <martin at martin.st>

---

 libavformat/hdsenc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c
index ea6e77c..c093293 100644
--- a/libavformat/hdsenc.c
+++ b/libavformat/hdsenc.c
@@ -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);



More information about the libav-commits mailing list