10l: Fix off-by-one in MuxingApp element.
authorNathan Caldwell <saintdev@gmail.com>
Sun, 18 Jul 2010 03:21:05 +0000 (17 21:21 -0600)
committerNathan Caldwell <saintdev@gmail.com>
Sun, 18 Jul 2010 03:21:05 +0000 (17 21:21 -0600)
src/matroska.c

index 94170a5..7804640 100644 (file)
@@ -158,7 +158,8 @@ int mk_writeHeader(mk_Writer *w, const char *writingApp)
        if ((c = mk_createContext(w, w->root, MATROSKA_ID_INFO)) == NULL)       /* SegmentInfo */
                return -1;
        w->seek_data.segmentinfo = w->root->d_cur - w->segment_ptr;
-       CHECK(mk_writeVoid(c, 16));     /* Reserve space for a SegmentUID, to be written it later. */
+       /* Reserve space for a SegmentUID (16 bytes + 1 byte longer EBML ID), to be written it later. */
+       CHECK(mk_writeVoid(c, 16 + 1));
        CHECK(mk_writeStr(c, MATROSKA_ID_MUXINGAPP, PACKAGE_STRING));   /* MuxingApp */
        CHECK(mk_writeStr(c, MATROSKA_ID_WRITINGAPP, writingApp));      /* WritingApp */
        CHECK(mk_writeUInt(c, MATROSKA_ID_TIMECODESCALE, w->timescale));        /* TimecodeScale */
@@ -502,7 +503,7 @@ int mk_close(mk_Writer *w)
                if (mk_flushContextData(w->root) < 0)
                        ret = -1;
        }
-       
+
        if (w->attachments != NULL) {
                w->seek_data.attachments = w->f_pos - w->segment_ptr;
                mk_writeAttachments(w);