Commit Graph

2 Commits

Author SHA1 Message Date
Moritz Bunkus
932fc8f8bd tests: mark certain commands as not to produce a hash result
This is used by the controller to determine which commands to prefix
with (*) markers in case of test failure.
2017-08-12 10:51:33 +02:00
Moritz Bunkus
8d78387b09 kax_analyzer_c: fix creating voids for gaps of 130 bytes
A two-byte header field (one for the ID, one for the content size) can
have a content size of at most 127 bytes, meaning a total size of 129 is
easy to achieve: set the content size to 127 bytes, libEBML will
calculate the required length of the content size field to be 1 and the
resulting element's total size will be the desired 129 bytes.

A content size of 128 would mean that the content size field must be at
least two bytes long. Taking the element's ID into account this would
mean a total element size of 128 + 2 + 1 = 131 bytes. So getting libEBML
to produce an element of a total size of 131 is easy, too: set the
content size to 128 bytes, and libEBML will do the rest.

The problematic total size is a 130 bytes. There simply is no content
size for which adding the minimal length of the content size field and 1
for the ID would result in a total size of 130 bytes.

The solution is writing the length field with more bytes than
necessary. In the case of a total size of 130 bytes we could use the
maximum one-byte content size = 127 bytes, add one byte for the ID and
force the content size field's length to be two instead of one
byte (0x407f instead of 0xff).

Similar corner cases exist for the transition between content size field
being two/three bytes, three/four bytes long etc. In order to keep the
code simple we always use an eight-bytes long content size field if the
total size is at least nine bytes and a one-byte long content size field
otherwise.
2015-02-23 21:03:50 +01:00