diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-11-24 02:08:21 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-11-24 03:32:24 +0100 |
commit | 8e576d58306df95d6373dd0ca2c1f21f1afaeca9 (patch) | |
tree | 5f7b9c8783b342e80e32b58b94ded819eb414b3c /libavcodec/bethsoftvideo.c | |
parent | 7ffa9ea05aa951b6b13e615f1bd3b8280f758561 (diff) | |
parent | bbb46f3ec7128d8a624f2aa5b4f99ec44c0b9567 (diff) |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
libavutil: add utility functions to simplify allocation of audio buffers.
libavutil: add planar sample formats and av_sample_fmt_is_planar()
avconv: fix segfault at EOF with delayed pictures
pcmdec: remove unneeded resetting of samples pointer
avconv: remove a now unused parameter from output_packet().
avconv: formatting fixes in output_packet()
avconv: declare some variables in blocks where they are used
avconv: use the same behavior when decoding audio/video/subs
bethsoftvideo: return proper consumed size for palette packets.
cdg: skip packets that don't contain a cdg command.
crcenc: add flags
avconv: use vsync 0 for AVFMT_NOTIMESTAMPS formats.
tiffenc: add a private option for selecting compression algorithm
md5enc: add flags
ARM: remove needless .text/.align directives
Conflicts:
doc/APIchanges
libavcodec/tiffenc.c
libavutil/avutil.h
libavutil/samplefmt.c
libavutil/samplefmt.h
tests/ref/fate/bethsoft-vid
tests/ref/fate/cdgraphics
tests/ref/fate/film-cvid-pcm-stereo-8bit
tests/ref/fate/mpeg2-field-enc
tests/ref/fate/nuv
tests/ref/fate/tiertex-seq
tests/ref/fate/tscc-32bit
tests/ref/fate/vmnc-32bit
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/bethsoftvideo.c')
-rw-r--r-- | libavcodec/bethsoftvideo.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c index 1a19c19d99..059947fead 100644 --- a/libavcodec/bethsoftvideo.c +++ b/libavcodec/bethsoftvideo.c @@ -47,15 +47,20 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx) return 0; } -static void set_palette(AVFrame * frame, const uint8_t * palette_buffer) +static int set_palette(AVFrame * frame, const uint8_t * palette_buffer, int buf_size) { uint32_t * palette = (uint32_t *)frame->data[1]; int a; + + if (buf_size < 256*3) + return AVERROR_INVALIDDATA; + for(a = 0; a < 256; a++){ palette[a] = 0xFF << 24 | AV_RB24(&palette_buffer[a * 3]) * 4; palette[a] |= palette[a] >> 6 & 0x30303; } frame->palette_has_changed = 1; + return 256*3; } static int bethsoftvid_decode_frame(AVCodecContext *avctx, @@ -82,8 +87,7 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx, switch(block_type = *buf++){ case PALETTE_BLOCK: - set_palette(&vid->frame, buf); - return 0; + return set_palette(&vid->frame, buf, buf_size); case VIDEO_YOFF_P_FRAME: yoffset = bytestream_get_le16(&buf); if(yoffset >= avctx->height) |