Revision 0580a122

View differences:

libavformat/matroskaenc.c
104 104
 */
105 105
static void put_ebml_size_unknown(ByteIOContext *pb, int bytes)
106 106
{
107
    bytes = FFMIN(bytes, 8);
107
    assert(bytes <= 8);
108 108
    put_byte(pb, 0x1ff >> bytes);
109 109
    while (--bytes)
110 110
        put_byte(pb, 0xff);
......
140 140
    if (bytes == 0)
141 141
        // don't care how many bytes are used, so use the min
142 142
        bytes = needed_bytes;
143
    else if (needed_bytes > bytes) {
144 143
        // the bytes needed to write the given size would exceed the bytes
145 144
        // that we need to use, so write unknown size. This shouldn't happen.
146
        av_log(NULL, AV_LOG_WARNING, "Size of %" PRIu64 " needs %d bytes but only %d bytes reserved\n",
147
               size, needed_bytes, bytes);
148
        put_ebml_size_unknown(pb, bytes);
149
        return;
150
    }
145
    assert(bytes >= needed_bytes);
151 146

  
152 147
    size |= 1ULL << bytes*7;
153 148
    for (i = bytes - 1; i >= 0; i--)
......
195 190
{
196 191
    offset_t currentpos = url_ftell(pb);
197 192

  
198
    if (size < 2)
199
        return;
193
    assert(size >= 2);
200 194

  
201 195
    put_ebml_id(pb, EBML_ID_VOID);
202 196
    // we need to subtract the length needed to store the size from the

Also available in: Unified diff