Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/KaxBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,6 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
if (Result != 5)
throw SafeReadIOCallback::EndOfStreamX(0);
binary *cursor = _TempHead;
binary *_tmpBuf;
std::uint8_t BlockHeadSize = 4;

// update internal values
Expand Down Expand Up @@ -699,8 +698,10 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
SizeList[Index] = LastBufferSize;
break;
case LACING_EBML:
{
SizeRead = LastBufferSize;
cursor = _tmpBuf = new binary[FrameNum*4]; /// \warning assume the mean size will be coded in less than 4 bytes
auto _tmpBuf = std::make_unique<binary[]>(FrameNum*4); /// \warning assume the mean size will be coded in less than 4 bytes
cursor = _tmpBuf.get();
Result += input.read(cursor, FrameNum*4);
FrameSize = ReadCodedSizeValue(cursor, SizeRead, SizeUnknown);
if (FrameSize > TotalLacedSize)
Expand All @@ -720,11 +721,11 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
LastBufferSize -= FrameSize + SizeRead;
}

FirstFrameLocation += cursor - _tmpBuf;
FirstFrameLocation += cursor - _tmpBuf.get();

SizeList[Index] = LastBufferSize;
delete [] _tmpBuf;
break;
}
case LACING_FIXED:
for (Index=0; Index<=FrameNum; Index++) {
// get the size of the frame
Expand Down