diff mbox series

[FFmpeg-devel,1/3] avcodec/bitstream: Don't check for undefined behaviour after it happened

Message ID 20200626202822.17751-1-andreas.rheinhardt@gmail.com
State Accepted
Commit 5e196dac22cc510db104922f99626a03b453ef4a
Headers show
Series [FFmpeg-devel,1/3] avcodec/bitstream: Don't check for undefined behaviour after it happened | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt June 26, 2020, 8:28 p.m. UTC
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/bitstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer June 27, 2020, 2:33 p.m. UTC | #1
On Fri, Jun 26, 2020 at 10:28:20PM +0200, Andreas Rheinhardt wrote:
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/bitstream.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index be8a0f634d..53a2db7451 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 AVERROR(EINVAL);
+    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)