libavfilter/drawutils.c:72: error: Null Dereference
  pointer `*line[plane]` last assigned on line 71 could be null and is dereferenced by call to `memset()` at line 72, column 13.

libavfilter/drawutils.c:26:1: start of procedure ff_fill_line_with_color()
24. enum { RED = 0, GREEN, BLUE, ALPHA };
25. 
26. int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
    ^
27.                             enum PixelFormat pix_fmt, uint8_t rgba_color[4],
28.                             int *is_packed_rgba, uint8_t rgba_map_ptr[4])

libavfilter/drawutils.c:30:5: 
28.                             int *is_packed_rgba, uint8_t rgba_map_ptr[4])
29. {
30.     uint8_t rgba_map[4] = {0};
        ^
31.     int i;
32.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];

libavfilter/drawutils.c:32:5: 
30.     uint8_t rgba_map[4] = {0};
31.     int i;
32.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
        ^
33.     int hsub = pix_desc->log2_chroma_w;
34. 

libavfilter/drawutils.c:33:5: 
31.     int i;
32.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
33.     int hsub = pix_desc->log2_chroma_w;
        ^
34. 
35.     *is_packed_rgba = 1;

libavfilter/drawutils.c:35:5: 
33.     int hsub = pix_desc->log2_chroma_w;
34. 
35.     *is_packed_rgba = 1;
        ^
36.     switch (pix_fmt) {
37.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;

libavfilter/drawutils.c:36:5: 
34. 
35.     *is_packed_rgba = 1;
36.     switch (pix_fmt) {
        ^
37.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
38.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;

libavfilter/drawutils.c:37:5: Switch condition is false. Skipping switch case
35.     *is_packed_rgba = 1;
36.     switch (pix_fmt) {
37.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
        ^
38.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
39.     case PIX_FMT_RGBA:

libavfilter/drawutils.c:38:5: Switch condition is false. Skipping switch case
36.     switch (pix_fmt) {
37.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
38.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
        ^
39.     case PIX_FMT_RGBA:
40.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;

libavfilter/drawutils.c:39:5: Switch condition is false. Skipping switch case
37.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
38.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
39.     case PIX_FMT_RGBA:
        ^
40.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
41.     case PIX_FMT_BGRA:

libavfilter/drawutils.c:40:5: Switch condition is false. Skipping switch case
38.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
39.     case PIX_FMT_RGBA:
40.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
        ^
41.     case PIX_FMT_BGRA:
42.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;

libavfilter/drawutils.c:41:5: Switch condition is false. Skipping switch case
39.     case PIX_FMT_RGBA:
40.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
41.     case PIX_FMT_BGRA:
        ^
42.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
43.     default:

libavfilter/drawutils.c:42:5: Switch condition is false. Skipping switch case
40.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
41.     case PIX_FMT_BGRA:
42.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
        ^
43.     default:
44.         *is_packed_rgba = 0;

libavfilter/drawutils.c:44:9: 
42.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
43.     default:
44.         *is_packed_rgba = 0;
            ^
45.     }
46. 

libavfilter/drawutils.c:47:9: Taking false branch
45.     }
46. 
47.     if (*is_packed_rgba) {
            ^
48.         pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
49.         for (i = 0; i < 4; i++)

libavfilter/drawutils.c:60:9: 
58.         int plane;
59. 
60.         dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
            ^
61.         dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
62.         dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);

libavfilter/drawutils.c:61:9: 
59. 
60.         dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
61.         dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
            ^
62.         dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
63.         dst_color[3] = rgba_color[3];

libavfilter/drawutils.c:62:9: 
60.         dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
61.         dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
62.         dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
            ^
63.         dst_color[3] = rgba_color[3];
64. 

libavfilter/drawutils.c:63:9: 
61.         dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
62.         dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
63.         dst_color[3] = rgba_color[3];
            ^
64. 
65.         for (plane = 0; plane < 4; plane++) {

libavfilter/drawutils.c:65:14: 
63.         dst_color[3] = rgba_color[3];
64. 
65.         for (plane = 0; plane < 4; plane++) {
                 ^
66.             int line_size;
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;

libavfilter/drawutils.c:65:25: Loop condition is true. Entering loop body
63.         dst_color[3] = rgba_color[3];
64. 
65.         for (plane = 0; plane < 4; plane++) {
                            ^
66.             int line_size;
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;

libavfilter/drawutils.c:67:26: Condition is false
65.         for (plane = 0; plane < 4; plane++) {
66.             int line_size;
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                             ^
68. 
69.             pixel_step[plane] = 1;

libavfilter/drawutils.c:67:40: Condition is false
65.         for (plane = 0; plane < 4; plane++) {
66.             int line_size;
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                                           ^
68. 
69.             pixel_step[plane] = 1;

libavfilter/drawutils.c:67:25: 
65.         for (plane = 0; plane < 4; plane++) {
66.             int line_size;
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                            ^
68. 
69.             pixel_step[plane] = 1;

libavfilter/drawutils.c:67:13: 
65.         for (plane = 0; plane < 4; plane++) {
66.             int line_size;
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                ^
68. 
69.             pixel_step[plane] = 1;

libavfilter/drawutils.c:69:13: 
67.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
68. 
69.             pixel_step[plane] = 1;
                ^
70.             line_size = (w >> hsub1) * pixel_step[plane];
71.             line[plane] = av_malloc(line_size);

libavfilter/drawutils.c:70:13: 
68. 
69.             pixel_step[plane] = 1;
70.             line_size = (w >> hsub1) * pixel_step[plane];
                ^
71.             line[plane] = av_malloc(line_size);
72.             memset(line[plane], dst_color[plane], line_size);

libavfilter/drawutils.c:71:13: 
69.             pixel_step[plane] = 1;
70.             line_size = (w >> hsub1) * pixel_step[plane];
71.             line[plane] = av_malloc(line_size);
                ^
72.             memset(line[plane], dst_color[plane], line_size);
73.         }

libavutil/mem.c:64:1: start of procedure av_malloc()
  62.    linker will do it automatically. */
  63. 
  64. void *av_malloc(FF_INTERNAL_MEM_TYPE size)
      ^
  65. {
  66.     void *ptr = NULL;

libavutil/mem.c:66:5: 
  64. void *av_malloc(FF_INTERNAL_MEM_TYPE size)
  65. {
  66.     void *ptr = NULL;
          ^
  67. #if CONFIG_MEMALIGN_HACK
  68.     long diff;

libavutil/mem.c:72:8: Taking true branch
  70. 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
             ^
  73.         return NULL;
  74. 

libavutil/mem.c:73:9: 
  71.     /* let's disallow possible ambiguous cases */
  72.     if(size > (INT_MAX-16) )
  73.         return NULL;
              ^
  74. 
  75. #if CONFIG_MEMALIGN_HACK

libavutil/mem.c:117:1: return from a call to av_malloc
  115. #endif
  116.     return ptr;
  117. }
       ^
  118. 
  119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)

libavfilter/drawutils.c:72:13: 
70.             line_size = (w >> hsub1) * pixel_step[plane];
71.             line[plane] = av_malloc(line_size);
72.             memset(line[plane], dst_color[plane], line_size);
                ^
73.         }
74.     }

int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],
                            enum PixelFormat pix_fmt, uint8_t rgba_color[4],
                            int *is_packed_rgba, uint8_t rgba_map_ptr[4])
{
    uint8_t rgba_map[4] = {0};
    int i;
    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
    int hsub = pix_desc->log2_chroma_w;
    *is_packed_rgba = 1;
    switch (pix_fmt) {
    case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
    case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
    case PIX_FMT_RGBA:
    case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
    case PIX_FMT_BGRA:
    case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
    default:
        *is_packed_rgba = 0;
    }
    if (*is_packed_rgba) {
        pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
        for (i = 0; i < 4; i++)
            dst_color[rgba_map[i]] = rgba_color[i];
        line[0] = av_malloc(w * pixel_step[0]);
        for (i = 0; i < w; i++)
            memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]);
        if (rgba_map_ptr)
            memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4);
    } else {
        int plane;
        dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
        dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
        dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
        dst_color[3] = rgba_color[3];
        for (plane = 0; plane < 4; plane++) {
            int line_size;
            int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
            pixel_step[plane] = 1;
            line_size = (w >> hsub1) * pixel_step[plane];
            line[plane] = av_malloc(line_size);
            memset(line[plane], dst_color[plane], line_size);
        }
    }
    return 0;
}
['int ff_fill_line_with_color(uint8_t *line[4], int pixel_step[4], int w, uint8_t dst_color[4],\n                            enum PixelFormat pix_fmt, uint8_t rgba_color[4],\n                            int *is_packed_rgba, uint8_t rgba_map_ptr[4])\n{\n    uint8_t rgba_map[4] = {0};\n    int i;\n    const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];\n    int hsub = pix_desc->log2_chroma_w;\n    *is_packed_rgba = 1;\n    switch (pix_fmt) {\n    case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;\n    case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;\n    case PIX_FMT_RGBA:\n    case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;\n    case PIX_FMT_BGRA:\n    case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;\n    default:\n        *is_packed_rgba = 0;\n    }\n    if (*is_packed_rgba) {\n        pixel_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;\n        for (i = 0; i < 4; i++)\n            dst_color[rgba_map[i]] = rgba_color[i];\n        line[0] = av_malloc(w * pixel_step[0]);\n        for (i = 0; i < w; i++)\n            memcpy(line[0] + i * pixel_step[0], dst_color, pixel_step[0]);\n        if (rgba_map_ptr)\n            memcpy(rgba_map_ptr, rgba_map, sizeof(rgba_map[0]) * 4);\n    } else {\n        int plane;\n        dst_color[0] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);\n        dst_color[1] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);\n        dst_color[2] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);\n        dst_color[3] = rgba_color[3];\n        for (plane = 0; plane < 4; plane++) {\n            int line_size;\n            int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;\n            pixel_step[plane] = 1;\n            line_size = (w >> hsub1) * pixel_step[plane];\n            line[plane] = av_malloc(line_size);\n            memset(line[plane], dst_color[plane], line_size);\n        }\n    }\n    return 0;\n}', 'void *av_malloc(FF_INTERNAL_MEM_TYPE size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+16);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&15) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,16,size))\n        ptr = NULL;\n#elif HAVE_MEMALIGN\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']