libavcodec/idcinvideo.c:166: error: Buffer Overrun L2
  Offset: [0, 766] (⇐ [0, 255] + [0, 511]) Size: 256 by call to `huff_build_tree`.

libavcodec/idcinvideo.c:163:10: Assignment
161.     /* build the 256 Huffman decode trees */
162.     histograms = (unsigned char *)s->avctx->extradata;
163.     for (i = 0; i < 256; i++) {
              ^
164.         for(j = 0; j < HUF_TOKENS; j++)
165.             s->huff_nodes[i][j].count = histograms[histogram_index++];

libavcodec/idcinvideo.c:166:9: Call
164.         for(j = 0; j < HUF_TOKENS; j++)
165.             s->huff_nodes[i][j].count = histograms[histogram_index++];
166.         huff_build_tree(s, i);
             ^
167.     }
168. 

libavcodec/idcinvideo.c:122:9: <Offset trace>
120.     num_hnodes = HUF_TOKENS;
121.     hnodes = s->huff_nodes[prev];
122.     for(i = 0; i < HUF_TOKENS * 2; i++)
             ^
123.         hnodes[i].used = 0;
124. 

libavcodec/idcinvideo.c:122:9: Assignment
  120.     num_hnodes = HUF_TOKENS;
  121.     hnodes = s->huff_nodes[prev];
  122.     for(i = 0; i < HUF_TOKENS * 2; i++)
               ^
  123.         hnodes[i].used = 0;
  124. 

libavcodec/idcinvideo.c:116:1: <Length trace>
114.  *    That is: huff_nodes[prev][num_huff_nodes[prev]] is the root node.
115.  */
116. static av_cold void huff_build_tree(IdcinContext *s, int prev) {
     ^
117.     hnode_t *node, *hnodes;
118.      int num_hnodes, i;

libavcodec/idcinvideo.c:116:1: Parameter `prev`
  114.  *    That is: huff_nodes[prev][num_huff_nodes[prev]] is the root node.
  115.  */
  116. static av_cold void huff_build_tree(IdcinContext *s, int prev) {
       ^
  117.     hnode_t *node, *hnodes;
  118.      int num_hnodes, i;

libavcodec/idcinvideo.c:121:5: Assignment
  119. 
  120.     num_hnodes = HUF_TOKENS;
  121.     hnodes = s->huff_nodes[prev];
           ^
  122.     for(i = 0; i < HUF_TOKENS * 2; i++)
  123.         hnodes[i].used = 0;

libavcodec/idcinvideo.c:123:9: Array access: Offset: [0, 766] (⇐ [0, 255] + [0, 511]) Size: 256 by call to `huff_build_tree` 
  121.     hnodes = s->huff_nodes[prev];
  122.     for(i = 0; i < HUF_TOKENS * 2; i++)
  123.         hnodes[i].used = 0;
               ^
  124. 
  125.     while (1) {

static av_cold void huff_build_tree(IdcinContext *s, int prev) {
    hnode_t *node, *hnodes;
     int num_hnodes, i;
    num_hnodes = HUF_TOKENS;
    hnodes = s->huff_nodes[prev];
    for(i = 0; i < HUF_TOKENS * 2; i++)
        hnodes[i].used = 0;
    while (1) {
        node = &hnodes[num_hnodes];
        node->children[0] = huff_smallest_node(hnodes, num_hnodes);
        if(node->children[0] == -1)
            break;
        node->children[1] = huff_smallest_node(hnodes, num_hnodes);
        if(node->children[1] == -1)
            break;
        node->count = hnodes[node->children[0]].count +
        hnodes[node->children[1]].count;
        num_hnodes++;
    }
    s->num_huff_nodes[prev] = num_hnodes - 1;
}
['static av_cold int idcin_decode_init(AVCodecContext *avctx)\n{\n    IdcinContext *s = avctx->priv_data;\n    int i, j, histogram_index = 0;\n    unsigned char *histograms;\n    s->avctx = avctx;\n    avctx->pix_fmt = PIX_FMT_PAL8;\n    if (s->avctx->extradata_size != HUFFMAN_TABLE_SIZE) {\n        av_log(s->avctx, AV_LOG_ERROR, "  Id CIN video: expected extradata size of %d\\n", HUFFMAN_TABLE_SIZE);\n        return -1;\n    }\n    histograms = (unsigned char *)s->avctx->extradata;\n    for (i = 0; i < 256; i++) {\n        for(j = 0; j < HUF_TOKENS; j++)\n            s->huff_nodes[i][j].count = histograms[histogram_index++];\n        huff_build_tree(s, i);\n    }\n    s->frame.data[0] = NULL;\n    return 0;\n}', 'static av_cold void huff_build_tree(IdcinContext *s, int prev) {\n    hnode_t *node, *hnodes;\n     int num_hnodes, i;\n    num_hnodes = HUF_TOKENS;\n    hnodes = s->huff_nodes[prev];\n    for(i = 0; i < HUF_TOKENS * 2; i++)\n        hnodes[i].used = 0;\n    while (1) {\n        node = &hnodes[num_hnodes];\n        node->children[0] = huff_smallest_node(hnodes, num_hnodes);\n        if(node->children[0] == -1)\n            break;\n        node->children[1] = huff_smallest_node(hnodes, num_hnodes);\n        if(node->children[1] == -1)\n            break;\n        node->count = hnodes[node->children[0]].count +\n        hnodes[node->children[1]].count;\n        num_hnodes++;\n    }\n    s->num_huff_nodes[prev] = num_hnodes - 1;\n}']