~ubuntu-branches/ubuntu/trusty/mariadb-5.5/trusty-proposed

« back to all changes in this revision

Viewing changes to storage/tokudb/ft-index/third_party/xz-4.999.9beta/src/liblzma/check/crc32_small.c

  • Committer: Package Import Robot
  • Author(s): James Page, Otto Kekäläinen
  • Date: 2014-02-17 16:51:52 UTC
  • mfrom: (2.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20140217165152-k315d3175g865kkx
Tags: 5.5.35-1
[ Otto Kekäläinen ]
* New upstream release, fixing the following security issues:
  - Buffer overflow in client/mysql.cc (Closes: #737597).
    - CVE-2014-0001
  - http://www.oracle.com/technetwork/topics/security/cpujan2014-1972949.html
    - CVE-2013-5891
    - CVE-2013-5908
    - CVE-2014-0386
    - CVE-2014-0393
    - CVE-2014-0401
    - CVE-2014-0402
    - CVE-2014-0412
    - CVE-2014-0420
    - CVE-2014-0437
* Upstream https://mariadb.atlassian.net/browse/MDEV-4902
  fixes compatibility with Bison 3.0 (Closes: #733002)
* Updated Russian debconf translation (Closes: #734426)
* Updated Japanese debconf translation (Closes: #735284)
* Updated French debconf translation (Closes: #736480)
* Renamed SONAME properly (Closes: #732967)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
 
2
// vim: expandtab:ts=8:sw=4:softtabstop=4:
 
3
///////////////////////////////////////////////////////////////////////////////
 
4
//
 
5
/// \file       crc32_small.c
 
6
/// \brief      CRC32 calculation (size-optimized)
 
7
//
 
8
//  Author:     Lasse Collin
 
9
//
 
10
//  This file has been put into the public domain.
 
11
//  You can do whatever you want with this file.
 
12
//
 
13
///////////////////////////////////////////////////////////////////////////////
 
14
 
 
15
#include "check.h"
 
16
 
 
17
 
 
18
uint32_t lzma_crc32_table[1][256];
 
19
 
 
20
 
 
21
static void
 
22
crc32_init(void)
 
23
{
 
24
        static const uint32_t poly32 = UINT32_C(0xEDB88320);
 
25
 
 
26
        for (size_t b = 0; b < 256; ++b) {
 
27
                uint32_t r = b;
 
28
                for (size_t i = 0; i < 8; ++i) {
 
29
                        if (r & 1)
 
30
                                r = (r >> 1) ^ poly32;
 
31
                        else
 
32
                                r >>= 1;
 
33
                }
 
34
 
 
35
                lzma_crc32_table[0][b] = r;
 
36
        }
 
37
 
 
38
        return;
 
39
}
 
40
 
 
41
 
 
42
extern void
 
43
lzma_crc32_init(void)
 
44
{
 
45
        mythread_once(crc32_init);
 
46
        return;
 
47
}
 
48
 
 
49
 
 
50
extern LZMA_API(uint32_t)
 
51
lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
 
52
{
 
53
        lzma_crc32_init();
 
54
 
 
55
        crc = ~crc;
 
56
 
 
57
        while (size != 0) {
 
58
                crc = lzma_crc32_table[0][*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
 
59
                --size;
 
60
        }
 
61
 
 
62
        return ~crc;
 
63
}