mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-04-19 09:02:26 +02:00
avcodec/cbs_jpeg: Fix size of huffman symbol table array
L[i] can be in the range of 0-255, see table B.5 of ITU T.81. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
0dd1ff67c8
commit
321c31cfe6
@ -99,7 +99,7 @@ typedef struct JPEGRawHuffmanTable {
|
|||||||
uint8_t Tc;
|
uint8_t Tc;
|
||||||
uint8_t Th;
|
uint8_t Th;
|
||||||
uint8_t L[16];
|
uint8_t L[16];
|
||||||
uint8_t V[224];
|
uint8_t V[256];
|
||||||
} JPEGRawHuffmanTable;
|
} JPEGRawHuffmanTable;
|
||||||
|
|
||||||
typedef struct JPEGRawHuffmanTableSpecification {
|
typedef struct JPEGRawHuffmanTableSpecification {
|
||||||
|
@ -84,12 +84,12 @@ static int FUNC(huffman_table)(CodedBitstreamContext *ctx, RWContext *rw,
|
|||||||
u(4, Th, 0, 3);
|
u(4, Th, 0, 3);
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
us(8, L[i], i, 0, 224);
|
us(8, L[i], i, 0, 255);
|
||||||
|
|
||||||
ij = 0;
|
ij = 0;
|
||||||
for (i = 0; i < 16; i++) {
|
for (i = 0; i < 16; i++) {
|
||||||
for (j = 0; j < current->L[i]; j++) {
|
for (j = 0; j < current->L[i]; j++) {
|
||||||
if (ij >= 224)
|
if (ij >= FF_ARRAY_ELEMS(current->V))
|
||||||
return AVERROR_INVALIDDATA;
|
return AVERROR_INVALIDDATA;
|
||||||
us(8, V[ij], ij, 0, 255);
|
us(8, V[ij], ij, 0, 255);
|
||||||
++ij;
|
++ij;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user