ffmpeg.c:3702: error: Integer Overflow L2
  ([1, 2147483648] × 4):signed32 by call to `grow_array`.

ffmpeg.c:3701:11: Call
3699.     }
3700.     *p++ = '\0';
3701.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
                ^
3702.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3703.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

cmdutils.c:96:5: Assignment
  94.     fprintf(stderr, error, context, numstr, min, max);
  95.     exit_program(1);
  96.     return 0;
          ^
  97. }
  98. 

ffmpeg.c:3701:5: Assignment
3699.     }
3700.     *p++ = '\0';
3701.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
          ^
3702.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
3703.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

ffmpeg.c:3702:20: Call
3700.     *p++ = '\0';
3701.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
3702.     streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
                         ^
3703.     streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
3704.     return 0;

cmdutils.c:994:1: <LHS trace>
992. #endif /* CONFIG_AVFILTER */
993. 
994. void *grow_array(void *array, int elem_size, int *size, int new_size)
     ^
995. {
996.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:994:1: Parameter `new_size`
  992. #endif /* CONFIG_AVFILTER */
  993. 
  994. void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  995. {
  996.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:994:1: <RHS trace>
992. #endif /* CONFIG_AVFILTER */
993. 
994. void *grow_array(void *array, int elem_size, int *size, int new_size)
     ^
995. {
996.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:994:1: Parameter `elem_size`
  992. #endif /* CONFIG_AVFILTER */
  993. 
  994. void *grow_array(void *array, int elem_size, int *size, int new_size)
       ^
  995. {
  996.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:1001:24: Binary operation: ([1, 2147483648] × 4):signed32 by call to `grow_array` 
   999.     }
  1000.     if (*size < new_size) {
  1001.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
                               ^
  1002.         if (!tmp) {
  1003.             av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");

void *grow_array(void *array, int elem_size, int *size, int new_size)
{
    if (new_size >= INT_MAX / elem_size) {
        av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
        exit_program(1);
    }
    if (*size < new_size) {
        uint8_t *tmp = av_realloc(array, new_size*elem_size);
        if (!tmp) {
            av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
            exit_program(1);
        }
        memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
        *size = new_size;
        return tmp;
    }
    return array;
}
['static int opt_streamid(const char *opt, const char *arg)\n{\n    int idx;\n    char *p;\n    char idx_str[16];\n    av_strlcpy(idx_str, arg, sizeof(idx_str));\n    p = strchr(idx_str, \':\');\n    if (!p) {\n        fprintf(stderr,\n                "Invalid value \'%s\' for option \'%s\', required syntax is \'index:value\'\\n",\n                arg, opt);\n        exit_program(1);\n    }\n    *p++ = \'\\0\';\n    idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);\n    streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);\n    streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);\n    return 0;\n}', 'double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)\n{\n    char *tail;\n    const char *error;\n    double d = av_strtod(numstr, &tail);\n    if (*tail)\n        error= "Expected number for %s but found: %s\\n";\n    else if (d < min || d > max)\n        error= "The value for %s was %s which is not within %f - %f\\n";\n    else if(type == OPT_INT64 && (int64_t)d != d)\n        error= "Expected int64 for %s but found %s\\n";\n    else if (type == OPT_INT && (int)d != d)\n        error= "Expected int for %s but found %s\\n";\n    else\n        return d;\n    fprintf(stderr, error, context, numstr, min, max);\n    exit_program(1);\n    return 0;\n}', 'void *grow_array(void *array, int elem_size, int *size, int new_size)\n{\n    if (new_size >= INT_MAX / elem_size) {\n        av_log(NULL, AV_LOG_ERROR, "Array too big.\\n");\n        exit_program(1);\n    }\n    if (*size < new_size) {\n        uint8_t *tmp = av_realloc(array, new_size*elem_size);\n        if (!tmp) {\n            av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\\n");\n            exit_program(1);\n        }\n        memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);\n        *size = new_size;\n        return tmp;\n    }\n    return array;\n}']