libavformat/utils.c:2694: error: Buffer Overrun L3
  Offset: [1, +oo] Size: [0, 2147483631].

libavformat/utils.c:2684:13: <Offset trace>
2682.             continue;
2683.         program = ac->programs[i];
2684.         for(j=0; j<program->nb_stream_indexes; j++)
                  ^
2685.             if(program->stream_index[j] == idx)
2686.                 return;

libavformat/utils.c:2684:13: Assignment
2682.             continue;
2683.         program = ac->programs[i];
2684.         for(j=0; j<program->nb_stream_indexes; j++)
                  ^
2685.             if(program->stream_index[j] == idx)
2686.                 return;

libavformat/utils.c:2688:13: <Length trace>
2686.                 return;
2687. 
2688.         if (av_reallocp_array(&program->stream_index,
                  ^
2689.                               program->nb_stream_indexes + 1,
2690.                               sizeof(*program->stream_index)) < 0) {

libavformat/utils.c:2688:13: Call
2686.                 return;
2687. 
2688.         if (av_reallocp_array(&program->stream_index,
                  ^
2689.                               program->nb_stream_indexes + 1,
2690.                               sizeof(*program->stream_index)) < 0) {

libavutil/mem.c:146:1: Parameter `*ptr`
  144. }
  145. 
  146. int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
       ^
  147. {
  148.     void **ptrptr = ptr;

libavformat/utils.c:2694:9: Array access: Offset: [1, +oo] Size: [0, 2147483631]
2692.             return;
2693.         }
2694.         program->stream_index[program->nb_stream_indexes++] = idx;
              ^
2695.         return;
2696.     }

void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)
{
    int i, j;
    AVProgram *program=NULL;
    if (idx >= ac->nb_streams) {
        av_log(ac, AV_LOG_ERROR, "stream index %d is not valid\n", idx);
        return;
    }
    for(i=0; i<ac->nb_programs; i++){
        if(ac->programs[i]->id != progid)
            continue;
        program = ac->programs[i];
        for(j=0; j<program->nb_stream_indexes; j++)
            if(program->stream_index[j] == idx)
                return;
        if (av_reallocp_array(&program->stream_index,
                              program->nb_stream_indexes + 1,
                              sizeof(*program->stream_index)) < 0) {
            program->nb_stream_indexes = 0;
            return;
        }
        program->stream_index[program->nb_stream_indexes++] = idx;
        return;
    }
}
['void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx)\n{\n    int i, j;\n    AVProgram *program=NULL;\n    if (idx >= ac->nb_streams) {\n        av_log(ac, AV_LOG_ERROR, "stream index %d is not valid\\n", idx);\n        return;\n    }\n    for(i=0; i<ac->nb_programs; i++){\n        if(ac->programs[i]->id != progid)\n            continue;\n        program = ac->programs[i];\n        for(j=0; j<program->nb_stream_indexes; j++)\n            if(program->stream_index[j] == idx)\n                return;\n        if (av_reallocp_array(&program->stream_index,\n                              program->nb_stream_indexes + 1,\n                              sizeof(*program->stream_index)) < 0) {\n            program->nb_stream_indexes = 0;\n            return;\n        }\n        program->stream_index[program->nb_stream_indexes++] = idx;\n        return;\n    }\n}', 'int av_reallocp_array(void *ptr, size_t nmemb, size_t size)\n{\n    void **ptrptr = ptr;\n    void *ret;\n    if (!size || nmemb >= INT_MAX / size)\n        return AVERROR(ENOMEM);\n    if (!nmemb) {\n        av_freep(ptr);\n        return 0;\n    }\n    ret = av_realloc(*ptrptr, nmemb * size);\n    if (!ret) {\n        av_freep(ptr);\n        return AVERROR(ENOMEM);\n    }\n    *ptrptr = ret;\n    return 0;\n}']