]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/sunrast.c
avcodec: Constify AVCodecs
[ffmpeg] / libavcodec / sunrast.c
index 98bc4ffa6396a0c458a433f8285b6586e0edfb3e..7e9a9b0be51481f8aa3aceda7411815e9ace58b4 100644 (file)
@@ -100,7 +100,11 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
     if (ret < 0)
         return ret;
 
-    if (buf_end - buf < maplength)
+    /* scanlines are aligned on 16 bit boundaries */
+    len  = (depth * w + 7) >> 3;
+    alen = len + (len & 1);
+
+    if (buf_end - buf < maplength + (len * h) * 3 / 256)
         return AVERROR_INVALIDDATA;
 
     if ((ret = ff_get_buffer(avctx, p, 0)) < 0)
@@ -136,10 +140,6 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
         stride = p->linesize[0];
     }
 
-    /* scanlines are aligned on 16 bit boundaries */
-    len  = (depth * w + 7) >> 3;
-    alen = len + (len & 1);
-
     if (type == RT_BYTE_ENCODED) {
         int value, run;
         uint8_t *end = ptr + h * stride;
@@ -205,7 +205,7 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data,
     return buf - bufstart;
 }
 
-AVCodec ff_sunrast_decoder = {
+const AVCodec ff_sunrast_decoder = {
     .name           = "sunrast",
     .long_name      = NULL_IF_CONFIG_SMALL("Sun Rasterfile image"),
     .type           = AVMEDIA_TYPE_VIDEO,