# HG changeset patch # User reimar # Date 1320539176 0 # Node ID 12bcb27faa26c98446b02a7b368af6f99736af9f # Parent 9f7eb00ed9f8793c50cebfed3783b69a2a8a8bd3 Do not create a 0-sized palette side data from extradata. Fixes decoding of interplay video files. diff -r 9f7eb00ed9f8 -r 12bcb27faa26 libmpcodecs/vd_ffmpeg.c --- a/libmpcodecs/vd_ffmpeg.c Sat Nov 05 23:12:16 2011 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Sun Nov 06 00:26:16 2011 +0000 @@ -785,13 +785,16 @@ pkt.flags = AV_PKT_FLAG_KEY; if (!ctx->palette_sent && sh->bih && sh->bih->biBitCount <= 8) { /* Pass palette to codec */ - uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); unsigned palsize = sh->bih->biSize - sizeof(*sh->bih); if (palsize == 0) { /* Palette size in biClrUsed */ palsize = sh->bih->biClrUsed * 4; } - memcpy(pal, sh->bih+1, FFMIN(palsize, AVPALETTE_SIZE)); + // if still 0, we simply have no palette in extradata. + if (palsize) { + uint8_t *pal = av_packet_new_side_data(&pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); + memcpy(pal, sh->bih+1, FFMIN(palsize, AVPALETTE_SIZE)); + } ctx->palette_sent = 1; } ret = avcodec_decode_video2(avctx, pic, &got_picture, &pkt);