~ubuntu-branches/ubuntu/utopic/ffmpeg-debian/utopic

« back to all changes in this revision

Viewing changes to libavcodec/ac3_parser.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-01-20 09:20:53 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120092053-izz63p40hc98qfgp
Tags: 3:0.svn20090119-1ubuntu1
* merge from debian. LP: #318501
* new version fixes CVE-2008-3230, LP: #253767

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
 
43
43
    hdr->sync_word = get_bits(gbc, 16);
44
44
    if(hdr->sync_word != 0x0B77)
45
 
        return AC3_PARSE_ERROR_SYNC;
 
45
        return AAC_AC3_PARSE_ERROR_SYNC;
46
46
 
47
47
    /* read ahead to bsid to distinguish between AC-3 and E-AC-3 */
48
48
    hdr->bitstream_id = show_bits_long(gbc, 29) & 0x1F;
49
49
    if(hdr->bitstream_id > 16)
50
 
        return AC3_PARSE_ERROR_BSID;
 
50
        return AAC_AC3_PARSE_ERROR_BSID;
51
51
 
52
52
    hdr->num_blocks = 6;
53
53
 
60
60
        hdr->crc1 = get_bits(gbc, 16);
61
61
        hdr->sr_code = get_bits(gbc, 2);
62
62
        if(hdr->sr_code == 3)
63
 
            return AC3_PARSE_ERROR_SAMPLE_RATE;
 
63
            return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
64
64
 
65
65
        frame_size_code = get_bits(gbc, 6);
66
66
        if(frame_size_code > 37)
67
 
            return AC3_PARSE_ERROR_FRAME_SIZE;
 
67
            return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
68
68
 
69
69
        skip_bits(gbc, 5); // skip bsid, already got it
70
70
 
93
93
        hdr->crc1 = 0;
94
94
        hdr->frame_type = get_bits(gbc, 2);
95
95
        if(hdr->frame_type == EAC3_FRAME_TYPE_RESERVED)
96
 
            return AC3_PARSE_ERROR_FRAME_TYPE;
 
96
            return AAC_AC3_PARSE_ERROR_FRAME_TYPE;
97
97
 
98
98
        hdr->substreamid = get_bits(gbc, 3);
99
99
 
100
100
        hdr->frame_size = (get_bits(gbc, 11) + 1) << 1;
101
101
        if(hdr->frame_size < AC3_HEADER_SIZE)
102
 
            return AC3_PARSE_ERROR_FRAME_SIZE;
 
102
            return AAC_AC3_PARSE_ERROR_FRAME_SIZE;
103
103
 
104
104
        hdr->sr_code = get_bits(gbc, 2);
105
105
        if (hdr->sr_code == 3) {
106
106
            int sr_code2 = get_bits(gbc, 2);
107
107
            if(sr_code2 == 3)
108
 
                return AC3_PARSE_ERROR_SAMPLE_RATE;
 
108
                return AAC_AC3_PARSE_ERROR_SAMPLE_RATE;
109
109
            hdr->sample_rate = ff_ac3_sample_rate_tab[sr_code2] / 2;
110
110
            hdr->sr_shift = 1;
111
111
        } else {
158
158
        int *need_next_header, int *new_frame_start)
159
159
{
160
160
    int err;
161
 
    uint64_t tmp = be2me_64(state);
 
161
    union {
 
162
        uint64_t u64;
 
163
        uint8_t  u8[8];
 
164
    } tmp = { be2me_64(state) };
162
165
    AC3HeaderInfo hdr;
163
166
    GetBitContext gbc;
164
167
 
165
 
    init_get_bits(&gbc, ((uint8_t *)&tmp)+8-AC3_HEADER_SIZE, 54);
 
168
    init_get_bits(&gbc, tmp.u8+8-AC3_HEADER_SIZE, 54);
166
169
    err = ff_ac3_parse_header(&gbc, &hdr);
167
170
 
168
171
    if(err < 0)