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

« back to all changes in this revision

Viewing changes to libavutil/crc.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:
18
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
19
 */
20
20
 
21
 
#include "common.h"
 
21
#include "config.h"
 
22
#include "bswap.h"
22
23
#include "crc.h"
23
24
 
24
 
#ifdef CONFIG_HARDCODED_TABLES
 
25
#if CONFIG_HARDCODED_TABLES
25
26
#include "crc_data.h"
26
27
#else
27
28
static struct {
74
75
        }
75
76
    }
76
77
    ctx[256]=1;
77
 
#ifndef CONFIG_SMALL
 
78
#if !CONFIG_SMALL
78
79
    if(ctx_size >= sizeof(AVCRC)*1024)
79
80
        for (i = 0; i < 256; i++)
80
81
            for(j=0; j<3; j++)
90
91
 * @return a pointer to the CRC table or NULL on failure
91
92
 */
92
93
const AVCRC *av_crc_get_table(AVCRCId crc_id){
93
 
#ifndef CONFIG_HARDCODED_TABLES
 
94
#if !CONFIG_HARDCODED_TABLES
94
95
    if (!av_crc_table[crc_id][FF_ARRAY_ELEMS(av_crc_table[crc_id])-1])
95
96
        if (av_crc_init(av_crc_table[crc_id],
96
97
                        av_crc_table_params[crc_id].le,
112
113
uint32_t av_crc(const AVCRC *ctx, uint32_t crc, const uint8_t *buffer, size_t length){
113
114
    const uint8_t *end= buffer+length;
114
115
 
115
 
#ifndef CONFIG_SMALL
 
116
#if !CONFIG_SMALL
116
117
    if(!ctx[256])
117
118
        while(buffer<end-3){
118
119
            crc ^= le2me_32(*(const uint32_t*)buffer); buffer+=4;