After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 309325 - Matroska: incorrect element size
Matroska: incorrect element size
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other All
: Normal critical
: 0.8.11
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-07-02 06:05 UTC by Josef Zlomek
Modified: 2005-07-02 08:35 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Josef Zlomek 2005-07-02 06:05:08 UTC
Please describe the problem:
ebml writer wrongly encodes element size 127, 16383, ...
According to the matroska specification
(http://www.matroska.org/technical/specs/index.html), the sizes of 2^(7*i)-1
have to be encoded as i+1 bytes long sequence instead of i bytes.
For example 127 should not be encoded as 0xff, but it should be 0x40 0x7f.
Matroska muxer encodes 127 as 0xff, which makes all decoders crash.

The attached patch fixes the encoding of size.

Steps to reproduce:
1. 
2. 
3. 


Actual results:


Expected results:


Does this happen every time?


Other information:
Comment 1 Josef Zlomek 2005-07-02 06:05:41 UTC
Index: ebml-write.c
===================================================================
RCS file: /cvs/gstreamer/gst-plugins/gst/matroska/ebml-write.c,v
retrieving revision 1.8
diff -c -p -u -p -r1.8 ebml-write.c
--- ebml-write.c    1 Sep 2004 12:10:21 -0000   1.8
+++ ebml-write.c    2 Jul 2005 05:57:02 -0000
@@ -218,7 +218,7 @@ gst_ebml_write_element_size (GstBuffer *
   guint bytes = 1, mask = 0x80;

   /* how many bytes? */
-  while ((size >> ((bytes - 1) * 8)) >= mask && bytes <= 8) {
+  while ((size >> ((bytes - 1) * 8)) >= (mask - 1) && bytes <= 8) {
     mask >>= 1;
     bytes++;
   }
Comment 2 Ronald Bultje 2005-07-02 08:35:22 UTC
Thanks, applied. I should've known that... :-(.