Skip to content

Commit

Permalink
libmatroska2: always initialize the lace FrameSize
Browse files Browse the repository at this point in the history
It's used to skip the data no matter what.
  • Loading branch information
robUx4 committed Dec 30, 2024
1 parent 3e8b1d6 commit 2f2192c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libmatroska2/matroskamain.c
Original file line number Diff line number Diff line change
Expand Up @@ -1206,11 +1206,11 @@ err_t MATROSKA_BlockReadData(matroska_block *Element, struct stream *Input, int
size_t Offset = 0;
for (NumFrame=0;Err==ERR_NONE && NumFrame<ARRAYCOUNT(Element->SizeList,int32_t);++NumFrame)
{
FrameSize = ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame];
#if defined(CONFIG_ZLIB)
if (EBML_IntegerValue((ebml_integer*)Header)==MATROSKA_TRACK_ENCODING_COMP_ZLIB)
{
size_t UncompressedSize;
FrameSize = ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame];
Err = UnCompressFrameZLib(InBuf, FrameSize, &Element->Data, &UncompressedSize, &Offset);
if (Err == ERR_NONE)
{
Expand All @@ -1227,12 +1227,11 @@ err_t MATROSKA_BlockReadData(matroska_block *Element, struct stream *Input, int
else
{
lzo_uint outSize = max(2048, ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame] << 2);
FrameSize = ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame];
if (!ArrayResize(&Element->Data, OutSize + outSize, 0))
Err = ERR_OUT_OF_MEMORY;
else
{
if (lzo1x_decompress_safe(InBuf, ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame], ARRAYBEGIN(Element->Data,uint8_t) + OutSize, &outSize, NULL) != LZO_E_OK)
if (lzo1x_decompress_safe(InBuf, FrameSize, ARRAYBEGIN(Element->Data,uint8_t) + OutSize, &outSize, NULL) != LZO_E_OK)
Err = ERR_INVALID_DATA;
else
{
Expand All @@ -1257,7 +1256,7 @@ err_t MATROSKA_BlockReadData(matroska_block *Element, struct stream *Input, int
{
size_t Count;
stream.next_in = (char*)InBuf;
stream.avail_in = FrameSize = ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame];
stream.avail_in = FrameSize;
stream.next_out = ARRAYBEGIN(Element->Data,char) + OutSize;
do {
Count = stream.next_out - ARRAYBEGIN(Element->Data,char);
Expand Down

0 comments on commit 2f2192c

Please sign in to comment.