aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-06-25 15:10:35 +0200
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2020-07-01 16:55:40 +0200
commit706ae61cf3ab49be333ebaa4096bfd46aa1a64a2 (patch)
tree38b2a4ed573a4a7e423450ee78fb36c64a04e777
parent364a80ecb91d9b71c0306d323c2f2d7ca770c93e (diff)
downloadffmpeg-706ae61cf3ab49be333ebaa4096bfd46aa1a64a2.tar.gz
avcodec/bitstream: Don't check for undefined behaviour after it happened
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> (cherry picked from commit 5e196dac22cc510db104922f99626a03b453ef4a) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
-rw-r--r--libavcodec/bitstream.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index ed528fe4af..237491978d 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -162,9 +162,9 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
uint32_t code;
volatile VLC_TYPE (* volatile table)[2]; // the double volatile is needed to prevent an internal compiler error in gcc 4.2
- table_size = 1 << table_nb_bits;
if (table_nb_bits > 30)
return -1;
+ table_size = 1 << table_nb_bits;
table_index = alloc_table(vlc, table_size, flags & INIT_VLC_USE_NEW_STATIC);
ff_dlog(NULL, "new table index=%d size=%d\n", table_index, table_size);
if (table_index < 0)