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

libavfilter/vf_pad.c:34:1: start of procedure fill_line_with_color()
32. enum { RED = 0, GREEN, BLUE, ALPHA };
33. 
34. static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4],
    ^
35.                                 enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)
36. {

libavfilter/vf_pad.c:37:5: 
35.                                 enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)
36. {
37.     uint8_t rgba_map[4] = {0};
        ^
38.     int i;
39.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];

libavfilter/vf_pad.c:39:5: 
37.     uint8_t rgba_map[4] = {0};
38.     int i;
39.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
        ^
40.     int hsub = pix_desc->log2_chroma_w;
41. 

libavfilter/vf_pad.c:40:5: 
38.     int i;
39.     const AVPixFmtDescriptor *pix_desc = &av_pix_fmt_descriptors[pix_fmt];
40.     int hsub = pix_desc->log2_chroma_w;
        ^
41. 
42.     *is_packed_rgba = 1;

libavfilter/vf_pad.c:42:5: 
40.     int hsub = pix_desc->log2_chroma_w;
41. 
42.     *is_packed_rgba = 1;
        ^
43.     switch (pix_fmt) {
44.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;

libavfilter/vf_pad.c:43:5: 
41. 
42.     *is_packed_rgba = 1;
43.     switch (pix_fmt) {
        ^
44.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
45.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;

libavfilter/vf_pad.c:44:5: Switch condition is false. Skipping switch case
42.     *is_packed_rgba = 1;
43.     switch (pix_fmt) {
44.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
        ^
45.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
46.     case PIX_FMT_RGBA:

libavfilter/vf_pad.c:45:5: Switch condition is false. Skipping switch case
43.     switch (pix_fmt) {
44.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
45.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
        ^
46.     case PIX_FMT_RGBA:
47.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;

libavfilter/vf_pad.c:46:5: Switch condition is false. Skipping switch case
44.     case PIX_FMT_ARGB:  rgba_map[ALPHA] = 0; rgba_map[RED  ] = 1; rgba_map[GREEN] = 2; rgba_map[BLUE ] = 3; break;
45.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
46.     case PIX_FMT_RGBA:
        ^
47.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
48.     case PIX_FMT_BGRA:

libavfilter/vf_pad.c:47:5: Switch condition is false. Skipping switch case
45.     case PIX_FMT_ABGR:  rgba_map[ALPHA] = 0; rgba_map[BLUE ] = 1; rgba_map[GREEN] = 2; rgba_map[RED  ] = 3; break;
46.     case PIX_FMT_RGBA:
47.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
        ^
48.     case PIX_FMT_BGRA:
49.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;

libavfilter/vf_pad.c:48:5: Switch condition is false. Skipping switch case
46.     case PIX_FMT_RGBA:
47.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
48.     case PIX_FMT_BGRA:
        ^
49.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
50.     default:

libavfilter/vf_pad.c:49:5: Switch condition is false. Skipping switch case
47.     case PIX_FMT_RGB24: rgba_map[RED  ] = 0; rgba_map[GREEN] = 1; rgba_map[BLUE ] = 2; rgba_map[ALPHA] = 3; break;
48.     case PIX_FMT_BGRA:
49.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
        ^
50.     default:
51.         *is_packed_rgba = 0;

libavfilter/vf_pad.c:51:9: 
49.     case PIX_FMT_BGR24: rgba_map[BLUE ] = 0; rgba_map[GREEN] = 1; rgba_map[RED  ] = 2; rgba_map[ALPHA] = 3; break;
50.     default:
51.         *is_packed_rgba = 0;
            ^
52.     }
53. 

libavfilter/vf_pad.c:54:9: Taking false branch
52.     }
53. 
54.     if (*is_packed_rgba) {
            ^
55.         line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
56.         for (i = 0; i < 4; i++)

libavfilter/vf_pad.c:65:9: 
63.         int plane;
64. 
65.         color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
            ^
66.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
67.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);

libavfilter/vf_pad.c:66:9: 
64. 
65.         color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
66.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
            ^
67.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
68.         color[ALPHA] = rgba_color[3];

libavfilter/vf_pad.c:67:9: 
65.         color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
66.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
67.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
            ^
68.         color[ALPHA] = rgba_color[3];
69. 

libavfilter/vf_pad.c:68:9: 
66.         color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
67.         color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
68.         color[ALPHA] = rgba_color[3];
            ^
69. 
70.         for (plane = 0; plane < 4; plane++) {

libavfilter/vf_pad.c:70:14: 
68.         color[ALPHA] = rgba_color[3];
69. 
70.         for (plane = 0; plane < 4; plane++) {
                 ^
71.             int line_size;
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;

libavfilter/vf_pad.c:70:25: Loop condition is true. Entering loop body
68.         color[ALPHA] = rgba_color[3];
69. 
70.         for (plane = 0; plane < 4; plane++) {
                            ^
71.             int line_size;
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;

libavfilter/vf_pad.c:72:26: Condition is false
70.         for (plane = 0; plane < 4; plane++) {
71.             int line_size;
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                             ^
73. 
74.             line_step[plane] = 1;

libavfilter/vf_pad.c:72:40: Condition is false
70.         for (plane = 0; plane < 4; plane++) {
71.             int line_size;
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                                           ^
73. 
74.             line_step[plane] = 1;

libavfilter/vf_pad.c:72:25: 
70.         for (plane = 0; plane < 4; plane++) {
71.             int line_size;
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                            ^
73. 
74.             line_step[plane] = 1;

libavfilter/vf_pad.c:72:13: 
70.         for (plane = 0; plane < 4; plane++) {
71.             int line_size;
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
                ^
73. 
74.             line_step[plane] = 1;

libavfilter/vf_pad.c:74:13: 
72.             int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
73. 
74.             line_step[plane] = 1;
                ^
75.             line_size = (w >> hsub1) * line_step[plane];
76.             line[plane] = av_malloc(line_size);

libavfilter/vf_pad.c:75:13: 
73. 
74.             line_step[plane] = 1;
75.             line_size = (w >> hsub1) * line_step[plane];
                ^
76.             line[plane] = av_malloc(line_size);
77.             memset(line[plane], color[plane], line_size);

libavfilter/vf_pad.c:76:13: 
74.             line_step[plane] = 1;
75.             line_size = (w >> hsub1) * line_step[plane];
76.             line[plane] = av_malloc(line_size);
                ^
77.             memset(line[plane], color[plane], line_size);
78.         }

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

libavutil/mem.c:66:5: 
  64. void *av_malloc(unsigned int 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, unsigned int size)

libavfilter/vf_pad.c:77:13: 
75.             line_size = (w >> hsub1) * line_step[plane];
76.             line[plane] = av_malloc(line_size);
77.             memset(line[plane], color[plane], line_size);
                ^
78.         }
79.     }

static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4],
                                enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)
{
    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) {
        line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;
        for (i = 0; i < 4; i++)
            color[rgba_map[i]] = rgba_color[i];
        line[0] = av_malloc(w * line_step[0]);
        for (i = 0; i < w; i++)
            memcpy(line[0] + i * line_step[0], color, line_step[0]);
    } else {
        int plane;
        color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);
        color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
        color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);
        color[ALPHA] = rgba_color[3];
        for (plane = 0; plane < 4; plane++) {
            int line_size;
            int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;
            line_step[plane] = 1;
            line_size = (w >> hsub1) * line_step[plane];
            line[plane] = av_malloc(line_size);
            memset(line[plane], color[plane], line_size);
        }
    }
    return 0;
}
['static int fill_line_with_color(uint8_t *line[4], int line_step[4], int w, uint8_t color[4],\n                                enum PixelFormat pix_fmt, uint8_t rgba_color[4], int *is_packed_rgba)\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        line_step[0] = (av_get_bits_per_pixel(pix_desc))>>3;\n        for (i = 0; i < 4; i++)\n            color[rgba_map[i]] = rgba_color[i];\n        line[0] = av_malloc(w * line_step[0]);\n        for (i = 0; i < w; i++)\n            memcpy(line[0] + i * line_step[0], color, line_step[0]);\n    } else {\n        int plane;\n        color[RED  ] = RGB_TO_Y_CCIR(rgba_color[0], rgba_color[1], rgba_color[2]);\n        color[GREEN] = RGB_TO_U_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);\n        color[BLUE ] = RGB_TO_V_CCIR(rgba_color[0], rgba_color[1], rgba_color[2], 0);\n        color[ALPHA] = rgba_color[3];\n        for (plane = 0; plane < 4; plane++) {\n            int line_size;\n            int hsub1 = (plane == 1 || plane == 2) ? hsub : 0;\n            line_step[plane] = 1;\n            line_size = (w >> hsub1) * line_step[plane];\n            line[plane] = av_malloc(line_size);\n            memset(line[plane], color[plane], line_size);\n        }\n    }\n    return 0;\n}', 'void *av_malloc(unsigned int 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}']