Revision 6e075dca

View differences:

libavcodec/ac3dec.c
37 37
#include "ac3dec_data.h"
38 38
#include "kbdwin.h"
39 39

  
40
/** Large enough for maximum possible frame size when the specification limit is ignored */
41
#define AC3_FRAME_BUFFER_SIZE 32768
42

  
43 40
/**
44 41
 * table for ungrouping 3 values in 7 bits.
45 42
 * used for exponents and bap=2 mantissas
......
204 201
    }
205 202
    s->downmixed = 1;
206 203

  
207
    /* allocate context input buffer */
208
        s->input_buffer = av_mallocz(AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
209
        if (!s->input_buffer)
210
            return AVERROR(ENOMEM);
211

  
212 204
    /* ffdshow custom code */
213 205
#if CONFIG_AUDIO_FLOAT
214 206
    avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
......
1441 1433
    ff_mdct_end(&s->imdct_512);
1442 1434
    ff_mdct_end(&s->imdct_256);
1443 1435

  
1444
    av_freep(&s->input_buffer);
1445

  
1446 1436
    return 0;
1447 1437
}
1448 1438

  
libavcodec/ac3dec.h
67 67

  
68 68
#define SPX_MAX_BANDS    17
69 69

  
70
/** Large enough for maximum possible frame size when the specification limit is ignored */
71
#define AC3_FRAME_BUFFER_SIZE 32768
72

  
70 73
typedef struct {
71 74
    AVCodecContext *avctx;                  ///< parent context
72 75
    GetBitContext gbc;                      ///< bitstream reader
73
    uint8_t *input_buffer;                  ///< temp buffer to prevent overread
74 76

  
75 77
///@defgroup bsi bit stream information
76 78
///@{
......
205 207
    DECLARE_ALIGNED(16, float, window)[AC3_BLOCK_SIZE];                              ///< window coefficients
206 208
    DECLARE_ALIGNED(16, float, tmp_output)[AC3_BLOCK_SIZE];                          ///< temporary storage for output before windowing
207 209
    DECLARE_ALIGNED(16, float, output)[AC3_MAX_CHANNELS][AC3_BLOCK_SIZE];            ///< output after imdct transform and windowing
210
    DECLARE_ALIGNED(16, uint8_t, input_buffer)[AC3_FRAME_BUFFER_SIZE + FF_INPUT_BUFFER_PADDING_SIZE]; ///< temp buffer to prevent overread
208 211
///@}
209 212
} AC3DecodeContext;
210 213

  

Also available in: Unified diff