libavcodec/h264_refs.c:663: error: Integer Overflow L2
  ([0, 1] - 1):unsigned32.

libavcodec/h264_refs.c:663:25: <LHS trace>
661.     h->mmco_index= 0;
662.     if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields
663.         s->broken_link= get_bits1(gb) -1;
                             ^
664.         if(get_bits1(gb)){
665.             h->mmco[0].opcode= MMCO_LONG;

libavcodec/h264_refs.c:663:25: Call
661.     h->mmco_index= 0;
662.     if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields
663.         s->broken_link= get_bits1(gb) -1;
                             ^
664.         if(get_bits1(gb)){
665.             h->mmco[0].opcode= MMCO_LONG;

libavcodec/get_bits.h:255:1: Parameter `s->index`
  253. }
  254. 
  255. static inline unsigned int get_bits1(GetBitContext *s)
       ^
  256. {
  257.     unsigned int index = s->index;

libavcodec/get_bits.h:257:5: Assignment
  255. static inline unsigned int get_bits1(GetBitContext *s)
  256. {
  257.     unsigned int index = s->index;
           ^
  258.     uint8_t result = s->buffer[index>>3];
  259. #ifdef BITSTREAM_READER_LE

libavcodec/get_bits.h:260:5: Assignment
  258.     uint8_t result = s->buffer[index>>3];
  259. #ifdef BITSTREAM_READER_LE
  260.     result >>= index & 7;
           ^
  261.     result &= 1;
  262. #else

libavcodec/get_bits.h:261:5: Assignment
  259. #ifdef BITSTREAM_READER_LE
  260.     result >>= index & 7;
  261.     result &= 1;
           ^
  262. #else
  263.     result <<= index & 7;

libavcodec/get_bits.h:272:5: Assignment
  270.     s->index = index;
  271. 
  272.     return result;
           ^
  273. }
  274. 

libavcodec/h264_refs.c:663:9: Binary operation: ([0, 1] - 1):unsigned32
661.     h->mmco_index= 0;
662.     if(h->nal_unit_type == NAL_IDR_SLICE){ //FIXME fields
663.         s->broken_link= get_bits1(gb) -1;
             ^
664.         if(get_bits1(gb)){
665.             h->mmco[0].opcode= MMCO_LONG;

int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
    MpegEncContext * const s = &h->s;
    int i;
    h->mmco_index= 0;
    if(h->nal_unit_type == NAL_IDR_SLICE){
        s->broken_link= get_bits1(gb) -1;
        if(get_bits1(gb)){
            h->mmco[0].opcode= MMCO_LONG;
            h->mmco[0].long_arg= 0;
            h->mmco_index= 1;
        }
    }else{
        if(get_bits1(gb)){
            for(i= 0; i<MAX_MMCO_COUNT; i++) {
                MMCOOpcode opcode= get_ue_golomb_31(gb);
                h->mmco[i].opcode= opcode;
                if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){
                    h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1);
                }
                if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){
                    unsigned int long_arg= get_ue_golomb_31(gb);
                    if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && long_arg == 16) && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){
                        av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\n", opcode);
                        return -1;
                    }
                    h->mmco[i].long_arg= long_arg;
                }
                if(opcode > (unsigned)MMCO_LONG){
                    av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\n", opcode);
                    return -1;
                }
                if(opcode == MMCO_END)
                    break;
            }
            h->mmco_index= i;
        }else{
            ff_generate_sliding_window_mmcos(h);
        }
    }
    return 0;
}
['int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){\n    MpegEncContext * const s = &h->s;\n    int i;\n    h->mmco_index= 0;\n    if(h->nal_unit_type == NAL_IDR_SLICE){\n        s->broken_link= get_bits1(gb) -1;\n        if(get_bits1(gb)){\n            h->mmco[0].opcode= MMCO_LONG;\n            h->mmco[0].long_arg= 0;\n            h->mmco_index= 1;\n        }\n    }else{\n        if(get_bits1(gb)){\n            for(i= 0; i<MAX_MMCO_COUNT; i++) {\n                MMCOOpcode opcode= get_ue_golomb_31(gb);\n                h->mmco[i].opcode= opcode;\n                if(opcode==MMCO_SHORT2UNUSED || opcode==MMCO_SHORT2LONG){\n                    h->mmco[i].short_pic_num= (h->curr_pic_num - get_ue_golomb(gb) - 1) & (h->max_pic_num - 1);\n                }\n                if(opcode==MMCO_SHORT2LONG || opcode==MMCO_LONG2UNUSED || opcode==MMCO_LONG || opcode==MMCO_SET_MAX_LONG){\n                    unsigned int long_arg= get_ue_golomb_31(gb);\n                    if(long_arg >= 32 || (long_arg >= 16 && !(opcode == MMCO_SET_MAX_LONG && long_arg == 16) && !(opcode == MMCO_LONG2UNUSED && FIELD_PICTURE))){\n                        av_log(h->s.avctx, AV_LOG_ERROR, "illegal long ref in memory management control operation %d\\n", opcode);\n                        return -1;\n                    }\n                    h->mmco[i].long_arg= long_arg;\n                }\n                if(opcode > (unsigned)MMCO_LONG){\n                    av_log(h->s.avctx, AV_LOG_ERROR, "illegal memory management control operation %d\\n", opcode);\n                    return -1;\n                }\n                if(opcode == MMCO_END)\n                    break;\n            }\n            h->mmco_index= i;\n        }else{\n            ff_generate_sliding_window_mmcos(h);\n        }\n    }\n    return 0;\n}', 'static inline unsigned int get_bits1(GetBitContext *s)\n{\n    unsigned int index = s->index;\n    uint8_t result = s->buffer[index>>3];\n#ifdef BITSTREAM_READER_LE\n    result >>= index & 7;\n    result &= 1;\n#else\n    result <<= index & 7;\n    result >>= 8 - 1;\n#endif\n#if !UNCHECKED_BITSTREAM_READER\n    if (s->index < s->size_in_bits_plus8)\n#endif\n        index++;\n    s->index = index;\n    return result;\n}']