libavformat/mxfenc.c:1808: 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:1782:1: Parameter `s->priv_data->body_partitions_count`
1780. }
1781. 
1782. static int mxf_write_footer(AVFormatContext *s)
      ^
1783. {
1784.     MXFContext *mxf = s->priv_data;

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

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

libavformat/mxfenc.c:1803:5: Call
1801. 
1802.     mxf_write_klv_fill(s);
1803.     mxf_write_random_index_pack(s);
          ^
1804. 
1805.     if (s->pb->seekable) {

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

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

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

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

libavformat/mxfenc.c:1231: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` 
  1229.         avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-2]); // PreviousPartition
  1230.     else if (!memcmp(key, footer_partition_key, 16) && mxf->body_partitions_count)
  1231.         avio_wb64(pb, mxf->body_partition_offset[mxf->body_partitions_count-1]); // PreviousPartition
                              ^
  1232.     else
  1233.         avio_wb64(pb, 0);
