]> granicus.if.org Git - libmatroska/commitdiff
KaxBlock: don't reset potentially unallocated memory
authorSteve Lhomme <robux4@ycbcr.xyz>
Mon, 11 Feb 2019 08:51:30 +0000 (09:51 +0100)
committerSteve Lhomme <robux4@ycbcr.xyz>
Sun, 19 May 2019 08:06:29 +0000 (10:06 +0200)
When using SCOPE_PARTIAL_DATA the GetBuffer()/Data pointer is never allocated.
If this exception occurs we must not write on NULL pointed data.

When the memory is allocated it doesn't have any use to reset the memory to 0
since SetValueIsSet(false) is called right before, invalidating the buffer.

src/KaxBlock.cpp

index 3fa18e51c999e76f0801164fcfa8b5a4c67dca60..878d9a225382edc742128cba6080b3d3c2c88d79 100644 (file)
@@ -703,7 +703,6 @@ filepos_t KaxInternalBlock::ReadData(IOCallback & input, ScopeMode ReadFully)
   } catch (SafeReadIOCallback::EndOfStreamX &) {
     SetValueIsSet(false);
 
-    std::memset(EbmlBinary::GetBuffer(), 0, GetSize());
     myBuffers.clear();
     SizeList.clear();
     Timecode           = 0;