libavformat/matroskaenc.c:336: error: Integer Overflow L2
  ([0, 9] - 1):unsigned64 by call to `put_ebml_void`.

libavformat/matroskaenc.c:335:76: Call
333. 
334.     if (seekhead->reserved_size > 0) {
335.         uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
                                                                                ^
336.         put_ebml_void(pb, remaining);
337.         avio_seek(pb, currentpos, SEEK_SET);

libavformat/avio.h:455:12: Call
  453. static av_always_inline int64_t avio_tell(AVIOContext *s)
  454. {
  455.     return avio_seek(s, 0, SEEK_CUR);
                  ^
  456. }
  457. 

libavformat/aviobuf.c:189:9: Assignment
    187. 
    188.     if(!s)
    189.         return AVERROR(EINVAL);
                 ^
    190. 
    191.     pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));

libavformat/avio.h:455:5: Assignment
  453. static av_always_inline int64_t avio_tell(AVIOContext *s)
  454. {
  455.     return avio_seek(s, 0, SEEK_CUR);
           ^
  456. }
  457. 

libavformat/matroskaenc.c:335:9: Assignment
333. 
334.     if (seekhead->reserved_size > 0) {
335.         uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
             ^
336.         put_ebml_void(pb, remaining);
337.         avio_seek(pb, currentpos, SEEK_SET);

libavformat/matroskaenc.c:336:9: Call
334.     if (seekhead->reserved_size > 0) {
335.         uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);
336.         put_ebml_void(pb, remaining);
             ^
337.         avio_seek(pb, currentpos, SEEK_SET);
338. 

libavformat/matroskaenc.c:204:1: <LHS trace>
202.  * @param size The number of bytes to reserve, which must be at least 2.
203.  */
204. static void put_ebml_void(AVIOContext *pb, uint64_t size)
     ^
205. {
206.     int64_t currentpos = avio_tell(pb);

libavformat/matroskaenc.c:204:1: Parameter `size`
  202.  * @param size The number of bytes to reserve, which must be at least 2.
  203.  */
  204. static void put_ebml_void(AVIOContext *pb, uint64_t size)
       ^
  205. {
  206.     int64_t currentpos = avio_tell(pb);

libavformat/matroskaenc.c:215:9: Binary operation: ([0, 9] - 1):unsigned64 by call to `put_ebml_void` 
  213.     // size if possible, 1 byte otherwise
  214.     if (size < 10)
  215.         put_ebml_num(pb, size-1, 0);
               ^
  216.     else
  217.         put_ebml_num(pb, size-9, 8);

static void put_ebml_void(AVIOContext *pb, uint64_t size)
{
    int64_t currentpos = avio_tell(pb);
    assert(size >= 2);
    put_ebml_id(pb, EBML_ID_VOID);
    if (size < 10)
        put_ebml_num(pb, size-1, 0);
    else
        put_ebml_num(pb, size-9, 8);
    while(avio_tell(pb) < currentpos + size)
        avio_w8(pb, 0);
}
['static int64_t mkv_write_seekhead(AVIOContext *pb, mkv_seekhead *seekhead)\n{\n    ebml_master metaseek, seekentry;\n    int64_t currentpos;\n    int i;\n    currentpos = avio_tell(pb);\n    if (seekhead->reserved_size > 0)\n        if (avio_seek(pb, seekhead->filepos, SEEK_SET) < 0)\n            return -1;\n    metaseek = start_ebml_master(pb, MATROSKA_ID_SEEKHEAD, seekhead->reserved_size);\n    for (i = 0; i < seekhead->num_entries; i++) {\n        mkv_seekhead_entry *entry = &seekhead->entries[i];\n        seekentry = start_ebml_master(pb, MATROSKA_ID_SEEKENTRY, MAX_SEEKENTRY_SIZE);\n        put_ebml_id(pb, MATROSKA_ID_SEEKID);\n        put_ebml_num(pb, ebml_id_size(entry->elementid), 0);\n        put_ebml_id(pb, entry->elementid);\n        put_ebml_uint(pb, MATROSKA_ID_SEEKPOSITION, entry->segmentpos);\n        end_ebml_master(pb, seekentry);\n    }\n    end_ebml_master(pb, metaseek);\n    if (seekhead->reserved_size > 0) {\n        uint64_t remaining = seekhead->filepos + seekhead->reserved_size - avio_tell(pb);\n        put_ebml_void(pb, remaining);\n        avio_seek(pb, currentpos, SEEK_SET);\n        currentpos = seekhead->filepos;\n    }\n    av_free(seekhead->entries);\n    av_free(seekhead);\n    return currentpos;\n}', 'static av_always_inline int64_t avio_tell(AVIOContext *s)\n{\n    return avio_seek(s, 0, SEEK_CUR);\n}', 'int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)\n{\n    int64_t offset1;\n    int64_t pos;\n    int force = whence & AVSEEK_FORCE;\n    whence &= ~AVSEEK_FORCE;\n    if(!s)\n        return AVERROR(EINVAL);\n    pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));\n    if (whence != SEEK_CUR && whence != SEEK_SET)\n        return AVERROR(EINVAL);\n    if (whence == SEEK_CUR) {\n        offset1 = pos + (s->buf_ptr - s->buffer);\n        if (offset == 0)\n            return offset1;\n        offset += offset1;\n    }\n    offset1 = offset - pos;\n    if (!s->must_flush &&\n        offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {\n        s->buf_ptr = s->buffer + offset1;\n    } else if ((!s->seekable ||\n               offset1 <= s->buf_end + SHORT_SEEK_THRESHOLD - s->buffer) &&\n               !s->write_flag && offset1 >= 0 &&\n              (whence != SEEK_END || force)) {\n        while(s->pos < offset && !s->eof_reached)\n            fill_buffer(s);\n        if (s->eof_reached)\n            return AVERROR_EOF;\n        s->buf_ptr = s->buf_end + offset - s->pos;\n    } else {\n        int64_t res;\n#if CONFIG_MUXERS || CONFIG_NETWORK\n        if (s->write_flag) {\n            flush_buffer(s);\n            s->must_flush = 1;\n        }\n#endif\n        if (!s->seek)\n            return AVERROR(EPIPE);\n        if ((res = s->seek(s->opaque, offset, SEEK_SET)) < 0)\n            return res;\n        if (!s->write_flag)\n            s->buf_end = s->buffer;\n        s->buf_ptr = s->buffer;\n        s->pos = offset;\n    }\n    s->eof_reached = 0;\n    return offset;\n}', 'static void put_ebml_void(AVIOContext *pb, uint64_t size)\n{\n    int64_t currentpos = avio_tell(pb);\n    assert(size >= 2);\n    put_ebml_id(pb, EBML_ID_VOID);\n    if (size < 10)\n        put_ebml_num(pb, size-1, 0);\n    else\n        put_ebml_num(pb, size-9, 8);\n    while(avio_tell(pb) < currentpos + size)\n        avio_w8(pb, 0);\n}']