diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-12-29 12:19:38 +0000 |
| commit | f7813a5324be39d13ab536c245d15dfc602a7849 (patch) | |
| tree | fad99148b88823d34a5df2f0a25881a002eb291b /ffmpeg/libavcodec/cdgraphics.c | |
| parent | b7a5a477b8ff4d4e3028b9dfb9a9df0a41463f92 (diff) | |
basic type mechanism working
Diffstat (limited to 'ffmpeg/libavcodec/cdgraphics.c')
| -rw-r--r-- | ffmpeg/libavcodec/cdgraphics.c | 8 |
1 files changed, 5 insertions, 3 deletions
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"), }; |
