ffmpeg | branch: release/3.2 | Andreas Rheinhardt 
<andreas.rheinha...@gmail.com> | Thu Jun 25 15:10:35 2020 +0200| 
[d7703a815f4f03bc105958b361f2a47c8ccc2678] | committer: Andreas Rheinhardt

avcodec/bitstream: Don't check for undefined behaviour after it happened

Reviewed-by: Michael Niedermayer <mich...@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>
(cherry picked from commit 5e196dac22cc510db104922f99626a03b453ef4a)
Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d7703a815f4f03bc105958b361f2a47c8ccc2678
---

 libavcodec/bitstream.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/bitstream.c b/libavcodec/bitstream.c
index fc520a6143..c7ca6be1c2 100644
--- a/libavcodec/bitstream.c
+++ b/libavcodec/bitstream.c
@@ -169,9 +169,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)

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to