]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/wnv1.c
cosmetics: iff: fix typo
[ffmpeg] / libavcodec / wnv1.c
index 6429a5b7481e3c327de0b4dc4700444668c57ef9..62e9b992a4b90c5b5d7150d65d3f407ca17d8b04 100644 (file)
@@ -64,12 +64,17 @@ static int decode_frame(AVCodecContext *avctx,
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     WNV1Context * const l = avctx->priv_data;
-    AVFrame * const p= (AVFrame*)&l->pic;
+    AVFrame * const p = &l->pic;
     unsigned char *Y,*U,*V;
     int i, j;
     int prev_y = 0, prev_u = 0, prev_v = 0;
     uint8_t *rbuf;
 
+    if(buf_size<=8) {
+        av_log(avctx, AV_LOG_ERROR, "buf_size %d is too small\n", buf_size);
+        return AVERROR_INVALIDDATA;
+    }
+
     rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
     if(!rbuf){
         av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
@@ -166,5 +171,5 @@ AVCodec ff_wnv1_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Winnov WNV1"),
 };