static int opt_streamid(const char *opt, const char *arg)
{
    int idx;
    char *p;
    char idx_str[16];
    strncpy(idx_str, arg, sizeof(idx_str));
    idx_str[sizeof(idx_str)-1] = '\0';
    p = strchr(idx_str, ':');
    if (!p) {
        fprintf(stderr,
                "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
                arg, opt);
        ffmpeg_exit(1);
    }
    *p++ = '\0';
    idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);
    streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
    streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
    return 0;
}
['static int opt_streamid(const char *opt, const char *arg)\n{\n    int idx;\n    char *p;\n    char idx_str[16];\n    strncpy(idx_str, arg, sizeof(idx_str));\n    idx_str[sizeof(idx_str)-1] = \'\\0\';\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        ffmpeg_exit(1);\n    }\n    *p++ = \'\\0\';\n    idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1);\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}', 'static void *grow_array(void *array, int elem_size, int *size, int new_size)\n{\n    if (new_size >= INT_MAX / elem_size) {\n        fprintf(stderr, "Array too big.\\n");\n        ffmpeg_exit(1);\n    }\n    if (*size < new_size) {\n        uint8_t *tmp = av_realloc(array, new_size*elem_size);\n        if (!tmp) {\n            fprintf(stderr, "Could not alloc buffer.\\n");\n            ffmpeg_exit(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}', 'void *av_realloc(void *ptr, unsigned int size)\n{\n#if CONFIG_MEMALIGN_HACK\n    int diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    if(!ptr) return av_malloc(size);\n    diff= ((char*)ptr)[-1];\n    return (char*)realloc((char*)ptr - diff, size + diff) + diff;\n#else\n    return realloc(ptr, size);\n#endif\n}']