From b7dbfcd78adc1ac8c38a2f8e3d64f6a67d74619b Mon Sep 17 00:00:00 2001 From: Steve Lhomme Date: Fri, 16 Apr 2010 13:33:13 +0000 Subject: [PATCH] v1: add a safety check assert git-svn-id: https://matroska.svn.sourceforge.net/svnroot/matroska/trunk/libmatroska@128 a6f86f6d-0131-4f8e-9e7b-e335508773d5 --- src/KaxBlock.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/KaxBlock.cpp b/src/KaxBlock.cpp index 4f79494..be00985 100644 --- a/src/KaxBlock.cpp +++ b/src/KaxBlock.cpp @@ -283,8 +283,10 @@ filepos_t KaxBlockVirtual::UpdateSize(bool bSaveDefault, bool bForceRender) binary *cursor = EbmlBinary::GetBuffer(); // fill data if (TrackNumber < 0x80) { + assert(GetSize() >= 4); *cursor++ = TrackNumber | 0x80; // set the first bit to 1 } else { + assert(GetSize() >= 5); *cursor++ = (TrackNumber >> 8) | 0x40; // set the second bit to 1 *cursor++ = TrackNumber & 0xFF; } -- 2.40.0