From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/cdgraphics.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ffmpeg/libavcodec/cdgraphics.c') diff --git a/ffmpeg/libavcodec/cdgraphics.c b/ffmpeg/libavcodec/cdgraphics.c index d22e9f6..b7a8fa7 100644 --- a/ffmpeg/libavcodec/cdgraphics.c +++ b/ffmpeg/libavcodec/cdgraphics.c @@ -265,7 +265,7 @@ static int cdg_decode_frame(AVCodecContext *avctx, int buf_size = avpkt->size; int ret; uint8_t command, inst; - uint8_t cdg_data[CDG_DATA_SIZE]; + uint8_t cdg_data[CDG_DATA_SIZE] = {0}; AVFrame *frame = data; CDGraphicsContext *cc = avctx->priv_data; @@ -289,7 +289,9 @@ static int cdg_decode_frame(AVCodecContext *avctx, inst = bytestream_get_byte(&buf); inst &= CDG_MASK; buf += 2; /// skipping 2 unneeded bytes - bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE); + + if (buf_size > CDG_HEADER_SIZE) + bytestream_get_buffer(&buf, cdg_data, buf_size - CDG_HEADER_SIZE); if ((command & CDG_MASK) == CDG_COMMAND) { switch (inst) { @@ -368,6 +370,7 @@ static av_cold int cdg_decode_end(AVCodecContext *avctx) AVCodec ff_cdgraphics_decoder = { .name = "cdgraphics", + .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_CDGRAPHICS, .priv_data_size = sizeof(CDGraphicsContext), @@ -375,5 +378,4 @@ AVCodec ff_cdgraphics_decoder = { .close = cdg_decode_end, .decode = cdg_decode_frame, .capabilities = CODEC_CAP_DR1, - .long_name = NULL_IF_CONFIG_SMALL("CD Graphics video"), }; -- cgit v1.2.3