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

« back to all changes in this revision

Viewing changes to libavcodec/dca_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:
34
34
    uint32_t lastmarker;
35
35
    int size;
36
36
    int framesize;
 
37
    int hd_pos;
37
38
} DCAParseContext;
38
39
 
39
40
#define IS_MARKER(state, i, buf, buf_size) \
75
76
        for (; i < buf_size; i++) {
76
77
            pc1->size++;
77
78
            state = (state << 8) | buf[i];
78
 
            if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size) && (!pc1->framesize || pc1->framesize == pc1->size)) {
 
79
            if (state == DCA_HD_MARKER && !pc1->hd_pos)
 
80
                pc1->hd_pos = pc1->size;
 
81
            if (state == pc1->lastmarker && IS_MARKER(state, i, buf, buf_size)) {
 
82
                if(pc1->framesize > pc1->size)
 
83
                    continue;
 
84
                if(!pc1->framesize){
 
85
                    pc1->framesize = pc1->hd_pos ? pc1->hd_pos : pc1->size;
 
86
                }
79
87
                pc->frame_start_found = 0;
80
88
                pc->state = -1;
81
 
                pc1->framesize = pc1->size;
82
89
                pc1->size = 0;
83
90
                return i - 3;
84
91
            }