History

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.

Andreas Rheinhardt committed 6 years ago

Commit df6ec7f1 parent 0da310d1 file · +1 −1Browse files

Showing the changes to libavcodec/bitstream.c (1 of 1 file). Show all

Unified · Split

libavcodec/bitstream.c+1−1
@@ -129,7 +129,7 @@ static int alloc_table(VLC *vlc, int size, int use_static) · 128 unmodified lines
129129
130130 typedef struct VLCcode {
131131 uint8_t bits;
132− uint16_t symbol;
132+ VLC_TYPE symbol;
133133 /** codeword, with the first bit-to-be-read in the msb
134134 * (even if intended for a little-endian bitstream reader) */
135135 uint32_t code;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t