Mercurial > libavcodec.hg
annotate dv_tablegen.c @ 12347:bc21b45eba99 libavcodec
vorbisdec: Prevent a potential integer overflow.
If sizeof uint_fast8_t > 1 and sizeof size_t <= 4, the expression that mallocs
classifs is susceptible to integer overflow.
author | alexc |
---|---|
date | Tue, 03 Aug 2010 00:25:06 +0000 |
parents | 59f399926c12 |
children |
rev | line source |
---|---|
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
1 /* |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
2 * Generate a header file for hardcoded DV tables |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
3 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
4 * Copyright (c) 2010 Reimar Döffinger <Reimar.Doeffinger@gmx.de> |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
5 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
6 * This file is part of FFmpeg. |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
7 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
8 * FFmpeg is free software; you can redistribute it and/or |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
9 * modify it under the terms of the GNU Lesser General Public |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
10 * License as published by the Free Software Foundation; either |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
11 * version 2.1 of the License, or (at your option) any later version. |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
12 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
13 * FFmpeg is distributed in the hope that it will be useful, |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
16 * Lesser General Public License for more details. |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
17 * |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
18 * You should have received a copy of the GNU Lesser General Public |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
19 * License along with FFmpeg; if not, write to the Free Software |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
21 */ |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
22 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
23 #include <stdlib.h> |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
24 #define CONFIG_HARDCODED_TABLES 0 |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
25 #ifndef CONFIG_SMALL |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
26 #error CONFIG_SMALL must be defined to generate tables |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
27 #endif |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
28 #include "dv_tablegen.h" |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
29 #include "tableprint.h" |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
30 #include <inttypes.h> |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
31 |
11979
59f399926c12
tableprint: use the type name as-is for the functions' names.
flameeyes
parents:
11570
diff
changeset
|
32 WRITE_1D_FUNC_ARGV(dv_vlc_pair, 7, |
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
33 "{0x%"PRIx32", %"PRId8"}", data[i].vlc, data[i].size) |
11979
59f399926c12
tableprint: use the type name as-is for the functions' names.
flameeyes
parents:
11570
diff
changeset
|
34 WRITE_2D_FUNC(dv_vlc_pair) |
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
35 |
11570 | 36 int main(void) |
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
37 { |
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
38 dv_vlc_map_tableinit(); |
11570 | 39 |
40 write_fileheader(); | |
11523
3367dd5913a0
Add support for hard-coding the 256kB large dv_vlc_map table.
reimar
parents:
diff
changeset
|
41 |
11570 | 42 printf("static const struct dv_vlc_pair dv_vlc_map[DV_VLC_MAP_RUN_SIZE][DV_VLC_MAP_LEV_SIZE] = {\n"); |
11979
59f399926c12
tableprint: use the type name as-is for the functions' names.
flameeyes
parents:
11570
diff
changeset
|
43 write_dv_vlc_pair_2d_array(dv_vlc_map, DV_VLC_MAP_RUN_SIZE, DV_VLC_MAP_LEV_SIZE); |
11570 | 44 printf("};\n"); |
45 | |
46 return 0; | |
47 } |