~siretart/xine-lib/ubuntu

« back to all changes in this revision

Viewing changes to src/libfaad/pns.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-15 13:13:45 UTC
  • mfrom: (0.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051215131345-8n4osv1j7fy9c1s1
* SECURITY UPDATE: Fix arbitrary code execution with crafted PNG images in
  embedded ffmpeg copy.
* src/libffmpeg/libavcodec/utils.c, avcodec_default_get_buffer(): Apply
  upstream patch to fix buffer overflow on decoding of small PIX_FMT_PAL8
  PNG files.
* References:
  CVE-2005-4048
  http://mplayerhq.hu/pipermail/ffmpeg-devel/2005-November/005333.html
  http://www1.mplayerhq.hu/cgi-bin/cvsweb.cgi/ffmpeg/libavcodec/
  utils.c.diff?r1=1.161&r2=1.162&cvsroot=FFMpeg

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
** Commercial non-GPL licensing of this software is possible.
23
23
** For more info contact Ahead Software through Mpeg4AAClicense@nero.com.
24
24
**
25
 
** $Id: pns.c,v 1.7 2004/12/03 01:15:30 tmattern Exp $
 
25
** $Id: pns.c,v 1.8 2005/10/29 23:57:07 tmmm Exp $
26
26
**/
27
27
 
28
28
#include "common.h"
70
70
 
71
71
static real_t pow2_table[] =
72
72
{
73
 
    COEF_CONST(0.59460355750136),
74
 
    COEF_CONST(0.70710678118655),
75
 
    COEF_CONST(0.84089641525371),
76
73
    COEF_CONST(1.0),
77
74
    COEF_CONST(1.18920711500272),
78
75
    COEF_CONST(1.41421356237310),
131
128
    {
132
129
        scale = DIV(REAL_CONST(1),energy);
133
130
 
134
 
        exp = scale_factor / 4;
135
 
        frac = scale_factor % 4;
 
131
        exp = scale_factor >> 2;
 
132
        frac = scale_factor & 3;
136
133
 
137
134
        /* IMDCT pre-scaling */
138
135
        exp -= sub;
143
140
            scale <<= exp;
144
141
 
145
142
        if (frac)
146
 
            scale = MUL_C(scale, pow2_table[frac + 3]);
 
143
            scale = MUL_C(scale, pow2_table[frac]);
147
144
 
148
145
        for (i = 0; i < size; i++)
149
146
        {
187
184
            {
188
185
                if (is_noise(ics_left, g, sfb))
189
186
                {
 
187
#ifdef LTP_DEC
190
188
                    /* Simultaneous use of LTP and PNS is not prevented in the
191
189
                       syntax. If both LTP, and PNS are enabled on the same
192
190
                       scalefactor band, PNS takes precedence, and no prediction
194
192
                    */
195
193
                    ics_left->ltp.long_used[sfb] = 0;
196
194
                    ics_left->ltp2.long_used[sfb] = 0;
 
195
#endif
197
196
 
 
197
#ifdef MAIN_DEC
198
198
                    /* For scalefactor bands coded using PNS the corresponding
199
199
                       predictors are switched to "off".
200
200
                    */
201
201
                    ics_left->pred.prediction_used[sfb] = 0;
 
202
#endif
202
203
 
203
204
                    offs = ics_left->swb_offset[sfb];
204
205
                    size = ics_left->swb_offset[sfb+1] - offs;
240
241
                                    spec_left[(group*nshort) + offs + c];
241
242
                            }
242
243
                        } else /*if (ics_left->ms_mask_present == 0)*/ {
 
244
#ifdef LTP_DEC
243
245
                            ics_right->ltp.long_used[sfb] = 0;
244
246
                            ics_right->ltp2.long_used[sfb] = 0;
 
247
#endif
 
248
#ifdef MAIN_DEC
245
249
                            ics_right->pred.prediction_used[sfb] = 0;
 
250
#endif
246
251
 
247
252
                            offs = ics_right->swb_offset[sfb];
248
253
                            size = ics_right->swb_offset[sfb+1] - offs;