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

avconv.c:4062:11: Call
4060.     }
4061.     *p++ = '\0';
4062.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
                ^
4063.     o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
4064.     o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

cmdutils.c:83:1: Parameter `min`
  81. }
  82. 
  83. double parse_number_or_die(const char *context, const char *numstr, int type,
      ^
  84.                            double min, double max)
  85. {

cmdutils.c:98:9: Assignment
   96.         error = "Expected int for %s but found %s\n";
   97.     else
   98.         return d;
               ^
   99.     av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max);
  100.     exit_program(1);

avconv.c:4062:5: Assignment
4060.     }
4061.     *p++ = '\0';
4062.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
          ^
4063.     o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
4064.     o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);

avconv.c:4063:23: Call
4061.     *p++ = '\0';
4062.     idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
4063.     o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
                            ^
4064.     o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
4065.     return 0;

cmdutils.c:1028:1: <LHS trace>
1026. }
1027. 
1028. void *grow_array(void *array, int elem_size, int *size, int new_size)
      ^
1029. {
1030.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:1028:1: Parameter `new_size`
  1026. }
  1027. 
  1028. void *grow_array(void *array, int elem_size, int *size, int new_size)
        ^
  1029. {
  1030.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:1028:1: <RHS trace>
1026. }
1027. 
1028. void *grow_array(void *array, int elem_size, int *size, int new_size)
      ^
1029. {
1030.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:1028:1: Parameter `elem_size`
  1026. }
  1027. 
  1028. void *grow_array(void *array, int elem_size, int *size, int new_size)
        ^
  1029. {
  1030.     if (new_size >= INT_MAX / elem_size) {

cmdutils.c:1035:24: Binary operation: ([1, 2147483648] × 4):signed32 by call to `grow_array` 
  1033.     }
  1034.     if (*size < new_size) {
  1035.         uint8_t *tmp = av_realloc(array, new_size*elem_size);
                               ^
  1036.         if (!tmp) {
  1037.             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(OptionsContext *o, 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        av_log(NULL, AV_LOG_FATAL,\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    o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);\n    o->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,\n                           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    av_log(NULL, AV_LOG_FATAL, 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}']