Browse Source

avcodec/bitstream: Consistently treat symbol as VLC_TYPE

If a static VLC table gets initialized a second time (or concurrently by
two threads) and if said VLC table uses symbols that have the sign bit
of VLC_TYPE (a typedef for int16_t) set, initializing the VLC fails. The
reason is that the type of the symbol in the temporary array is an
uint16_t and so comparing it to the symbol read from the VLC table will
fail, because only the lower 16bits coincide. Said failure triggers an
assert.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
tags/n4.4
Andreas Rheinhardt 4 years ago
parent
commit
df6ec7f83b
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      libavcodec/bitstream.c

+ 1
- 1
libavcodec/bitstream.c View File

@@ -129,7 +129,7 @@ static int alloc_table(VLC *vlc, int size, int use_static)


typedef struct VLCcode { typedef struct VLCcode {
uint8_t bits; uint8_t bits;
uint16_t symbol;
VLC_TYPE symbol;
/** codeword, with the first bit-to-be-read in the msb /** codeword, with the first bit-to-be-read in the msb
* (even if intended for a little-endian bitstream reader) */ * (even if intended for a little-endian bitstream reader) */
uint32_t code; uint32_t code;


Loading…
Cancel
Save