Commit a51e55f2 authored by Steve Lhomme's avatar Steve Lhomme

libmatroska2: fine tune the stupid lzo decompression as there is no way to...

libmatroska2: fine tune the stupid lzo decompression as there is no way to know the needed output size

git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/foundation_src@578 a6f86f6d-0131-4f8e-9e7b-e335508773d5
parent 7e000990
......@@ -171,12 +171,8 @@ size_t EBML_FillBufferID(uint8_t *Buffer, size_t BufSize, fourcc_t Id)
size_t i,FinalHeadSize = GetIdLength(Id);
if (BufSize < FinalHeadSize)
return 0;
#if 0 && defined(IS_BIG_ENDIAN)
memcpy(Buffer,&Id,FinalHeadSize);
#else
for (i=0;i<FinalHeadSize;++i)
Buffer[FinalHeadSize-i-1] = (uint8_t)(Id >> (i<<3));
#endif
return FinalHeadSize;
}
......
......@@ -1520,7 +1520,7 @@ err_t MATROSKA_BlockReadData(matroska_block *Element, stream *Input)
Err = ERR_INVALID_DATA;
else
{
lzo_uint outSize = ARRAYBEGIN(Element->SizeList,int32_t)[0] << 2;
lzo_uint outSize = max(2048, ARRAYBEGIN(Element->SizeList,int32_t)[0] << 2);
if (!ArrayResize(&Element->Data, outSize, 0))
Err = ERR_OUT_OF_MEMORY;
else
......@@ -1686,7 +1686,7 @@ err_t MATROSKA_BlockReadData(matroska_block *Element, stream *Input)
Err = ERR_INVALID_DATA;
else
{
lzo_uint outSize = ARRAYBEGIN(Element->SizeList,int32_t)[NumFrame] << 2;
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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment