diff dvdsubdec.c @ 10069:8ac9bc10b485 libavcodec

Always allocate a buffer of AVPALETTE_SIZE for palette in the subtitle decoders instead of as small as possible. This avoids completely unnecessary issues with e.g. libswscale.
author reimar
date Thu, 20 Aug 2009 18:54:50 +0000
parents e73c688ca84c
children 8a4984c5cacc
line wrap: on
line diff
--- a/dvdsubdec.c	Wed Aug 19 21:59:44 2009 +0000
+++ b/dvdsubdec.c	Thu Aug 20 18:54:50 2009 +0000
@@ -318,14 +318,13 @@
                            buf, offset1, buf_size, is_8bit);
                 decode_rle(bitmap + w, w * 2, w, h / 2,
                            buf, offset2, buf_size, is_8bit);
+                sub_header->rects[0]->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
                 if (is_8bit) {
                     if (yuv_palette == 0)
                         goto fail;
-                    sub_header->rects[0]->pict.data[1] = av_malloc(256 * 4);
                     sub_header->rects[0]->nb_colors = 256;
                     yuv_a_to_rgba(yuv_palette, alpha, (uint32_t*)sub_header->rects[0]->pict.data[1], 256);
                 } else {
-                    sub_header->rects[0]->pict.data[1] = av_malloc(4 * 4);
                     sub_header->rects[0]->nb_colors = 4;
                     guess_palette((uint32_t*)sub_header->rects[0]->pict.data[1],
                                   colormap, alpha, 0xffff00);