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

libavformat/matroskaenc.c:1237:1: Parameter `s->priv_data->reserve_cues_space`
1235. }
1236. 
1237. static int mkv_write_trailer(AVFormatContext *s)
      ^
1238. {
1239.     MatroskaMuxContext *mkv = s->priv_data;

libavformat/matroskaenc.c:1279:21: Call
1277. 
1278.                 if (cues_end < cuespos + mkv->reserve_cues_space)
1279.                     put_ebml_void(pb, mkv->reserve_cues_space - (cues_end - cuespos));
                          ^
1280. 
1281.                 avio_seek(pb, currentpos, SEEK_SET);

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

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

libavformat/matroskaenc.c:227:9: Binary operation: ([0, 9] - 1):unsigned64 by call to `put_ebml_void` 
  225.     // size if possible, 1 byte otherwise
  226.     if (size < 10)
  227.         put_ebml_num(pb, size-1, 0);
               ^
  228.     else
  229.         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 int mkv_write_trailer(AVFormatContext *s)\n{\n    MatroskaMuxContext *mkv = s->priv_data;\n    AVIOContext *pb = s->pb;\n    int64_t currentpos, cuespos;\n    int ret;\n    if (mkv->cur_audio_pkt.size > 0) {\n        ret = mkv_write_packet_internal(s, &mkv->cur_audio_pkt);\n        av_free_packet(&mkv->cur_audio_pkt);\n        if (ret < 0) {\n            av_log(s, AV_LOG_ERROR, "Could not write cached audio packet ret:%d\\n", ret);\n            return ret;\n        }\n    }\n    if (mkv->dyn_bc) {\n        end_ebml_master(mkv->dyn_bc, mkv->cluster);\n        mkv_flush_dynbuf(s);\n    } else if (mkv->cluster_pos) {\n        end_ebml_master(pb, mkv->cluster);\n    }\n    if (pb->seekable) {\n        if (mkv->cues->num_entries) {\n            if (mkv->reserve_cues_space) {\n                int64_t cues_end;\n                currentpos = avio_tell(pb);\n                avio_seek(pb, mkv->cues_pos, SEEK_SET);\n                cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);\n                cues_end = avio_tell(pb);\n                if (cues_end > cuespos + mkv->reserve_cues_space) {\n                    av_log(s, AV_LOG_ERROR, "Insufficient space reserved for cues: %d "\n                           "(needed: %"PRId64").\\n", mkv->reserve_cues_space,\n                           cues_end - cuespos);\n                    return AVERROR(EINVAL);\n                }\n                if (cues_end < cuespos + mkv->reserve_cues_space)\n                    put_ebml_void(pb, mkv->reserve_cues_space - (cues_end - cuespos));\n                avio_seek(pb, currentpos, SEEK_SET);\n            } else {\n                cuespos = mkv_write_cues(pb, mkv->cues, s->nb_streams);\n            }\n            ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES, cuespos);\n            if (ret < 0) return ret;\n        }\n        mkv_write_seekhead(pb, mkv->main_seekhead);\n        av_log(s, AV_LOG_DEBUG, "end duration = %" PRIu64 "\\n", mkv->duration);\n        currentpos = avio_tell(pb);\n        avio_seek(pb, mkv->duration_offset, SEEK_SET);\n        put_ebml_float(pb, MATROSKA_ID_DURATION, mkv->duration);\n        avio_seek(pb, currentpos, SEEK_SET);\n    }\n    end_ebml_master(pb, mkv->segment);\n    av_free(mkv->tracks);\n    av_freep(&mkv->cues->entries);\n    av_freep(&mkv->cues);\n    return 0;\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}']