libavformat/mxfenc.c:1811: error: Integer Overflow L2
  ([min(0, `s->priv_data->body_partitions_count`), 2+max(-1, `s->priv_data->body_partitions_count`)] - 1):unsigned32 by call to `mxf_write_partition`.

libavformat/mxfenc.c:1785:1: Parameter `s->priv_data->body_partitions_count`
1783. }
1784. 
1785. static int mxf_write_footer(AVFormatContext *s)
      ^
1786. {
1787.     MXFContext *mxf = s->priv_data;

libavformat/mxfenc.c:1796:20: Call
1794.     mxf->footer_partition_offset = avio_tell(pb);
1795.     if (mxf->edit_unit_byte_count) { // no need to repeat index
1796.         if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 0)) < 0)
                         ^
1797.             return err;
1798.     } else {

libavformat/mxfenc.c:1186:1: Parameter `s->priv_data->body_partitions_count`
  1184. }
  1185. 
  1186. static int mxf_write_partition(AVFormatContext *s, int bodysid,
        ^
  1187.                                 int indexsid,
  1188.                                 const uint8_t *key, int write_metadata)

libavformat/mxfenc.c:1806:5: Call
1804. 
1805.     mxf_write_klv_fill(s);
1806.     mxf_write_random_index_pack(s);
          ^
1807. 
1808.     if (s->pb->seekable & AVIO_SEEKABLE_NORMAL) {

libavformat/mxfenc.c:1758:1: Parameter `s->priv_data->body_partitions_count`
  1756. }
  1757. 
  1758. static void mxf_write_random_index_pack(AVFormatContext *s)
        ^
  1759. {
  1760.     MXFContext *mxf = s->priv_data;

libavformat/mxfenc.c:1811:24: Call
1809.         avio_seek(pb, 0, SEEK_SET);
1810.         if (mxf->edit_unit_byte_count) {
1811.             if ((err = mxf_write_partition(s, 1, 2, header_closed_partition_key, 1)) < 0)
                             ^
1812.                 return err;
1813.             mxf_write_klv_fill(s);

libavformat/mxfenc.c:1186:1: <LHS trace>
1184. }
1185. 
1186. static int mxf_write_partition(AVFormatContext *s, int bodysid,
      ^
1187.                                 int indexsid,
1188.                                 const uint8_t *key, int write_metadata)

libavformat/mxfenc.c:1186:1: Parameter `s->priv_data->body_partitions_count`
  1184. }
  1185. 
  1186. static int mxf_write_partition(AVFormatContext *s, int bodysid,
        ^
  1187.                                 int indexsid,
  1188.                                 const uint8_t *key, int write_metadata)

libavformat/mxfenc.c:1232:23: Binary operation: ([min(0, s->priv_data->body_partitions_count), 2+max(-1, s->priv_data->body_partitions_count)] - 1):unsigned32 by call to `mxf_write_partition` 
  1230.         avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition
  1231.     else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count)
  1232.         avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition
                              ^
  1233.     else
  1234.         avio_wb64(pb, 0);
