[Matroska-devel] KaxBlock is b0rked

Cyrius suiryc at yahoo.com
Wed Nov 26 20:28:57 CET 2003


Some new code has been added recently to read data
fully or partially.

But now KaxBlock is b0rked.

Here are the problems I spotted so far :

1. Previously the Frames found in a KaxBlock were
stored in a vector of DataBuffer elements. One would
then get a DataBuffer in this vector and have the
associated data (size of the frame).
A vector of uint32 data (a vector of frame sizes) has
been added so that the KaxBlock can hold the size of
each frame when data are read partially. But this
vector is not sized correctly (by default it has a
size of 0 elements), and yet the current code tries to
assign data in this vector (resulting in an access
violation).

A possible solution : add

SizeList.resize(FrameNum + 1);

when reading fully or partially the KaxBlock, just
before getting the sizes of the frames.


2. A new function (GetFrameSize) has been added for us
to retrieve the size of the frames (instead of getting
the DataBuffer - which aren't available when reading
partially). 2 problems here :

* when no lacing has been used (i.e. there is only one
frame) the size of the frame isn't stored anywhere
(except in the DataBuffer when reading fully) !!
A solution : add

SizeList.resize(1);
SizeList[0] = Size - BlockHeadSize;

in this case (LACING_NONE).

* when reading partially the bValueIsSet flag is set
to false. But the GetFrameSize function test it and
returns -1 if it is false !!!
Even if the value isn't set frame sizes have been
stored, so there is no need to test bValueIsSet here.


3. There is a function (NumberFrames) to get the
number of frames in the KaxBlock. But this function
returns the number of DataBuffer elements. So it is
only correct when reading fully the KaxBlock, and
returns 0 when reading partially (which is bad !!).
A solution : return the number of frame sizes we
retrieved in our vector (SizeList.size()).


I don't know who added those b0rks :p and if there was
something planned next, but let us know if we can fix
those b0rks now.

__________________________________
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
http://companion.yahoo.com/



More information about the Matroska-devel mailing list