libavcodec/vp8.c:230: error: Null Dereference
  pointer `s->intra4x4_pred_mode_base` last assigned on line 224 could be null and is dereferenced by call to `memset()` at line 230, column 5.

libavcodec/vp8.c:204:1: start of procedure update_dimensions()
202. }
203. 
204. static int update_dimensions(VP8Context *s, int width, int height)
     ^
205. {
206.     int i;

libavcodec/vp8.c:208:9: 
206.     int i;
207. 
208.     if (avcodec_check_dimensions(s->avctx, width, height))
             ^
209.         return AVERROR_INVALIDDATA;
210. 

libavcodec/utils.c:222:1: start of procedure avcodec_check_dimensions()
  220. }
  221. 
  222. int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
       ^
  223.     if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
  224.         return 0;

libavcodec/utils.c:223:8: Taking true branch
  221. 
  222. int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
  223.     if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
              ^
  224.         return 0;
  225. 

libavcodec/utils.c:223:20: Taking true branch
  221. 
  222. int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
  223.     if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
                          ^
  224.         return 0;
  225. 

libavcodec/utils.c:223:32: Taking true branch
  221. 
  222. int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
  223.     if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
                                      ^
  224.         return 0;
  225. 

libavcodec/utils.c:224:9: 
  222. int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
  223.     if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
  224.         return 0;
               ^
  225. 
  226.     av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);

libavcodec/utils.c:228:1: return from a call to avcodec_check_dimensions
  226.     av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
  227.     return AVERROR(EINVAL);
  228. }
       ^
  229. 
  230. int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){

libavcodec/vp8.c:208:9: Taking false branch
206.     int i;
207. 
208.     if (avcodec_check_dimensions(s->avctx, width, height))
             ^
209.         return AVERROR_INVALIDDATA;
210. 

libavcodec/vp8.c:211:5: Skipping vp8_decode_flush(): empty list of specs
209.         return AVERROR_INVALIDDATA;
210. 
211.     vp8_decode_flush(s->avctx);
         ^
212. 
213.     avcodec_set_dimensions(s->avctx, width, height);

libavcodec/vp8.c:213:5: 
211.     vp8_decode_flush(s->avctx);
212. 
213.     avcodec_set_dimensions(s->avctx, width, height);
         ^
214. 
215.     s->mb_width  = (s->avctx->coded_width +15) / 16;

libavcodec/utils.c:109:1: start of procedure avcodec_set_dimensions()
  107. }
  108. 
  109. void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
       ^
  110.     s->coded_width = width;
  111.     s->coded_height= height;

libavcodec/utils.c:110:5: 
  108. 
  109. void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
  110.     s->coded_width = width;
           ^
  111.     s->coded_height= height;
  112.     s->width = -((-width )>>s->lowres);

libavcodec/utils.c:111:5: 
  109. void avcodec_set_dimensions(AVCodecContext *s, int width, int height){
  110.     s->coded_width = width;
  111.     s->coded_height= height;
           ^
  112.     s->width = -((-width )>>s->lowres);
  113.     s->height= -((-height)>>s->lowres);

libavcodec/utils.c:112:5: 
  110.     s->coded_width = width;
  111.     s->coded_height= height;
  112.     s->width = -((-width )>>s->lowres);
           ^
  113.     s->height= -((-height)>>s->lowres);
  114. }

libavcodec/utils.c:113:5: 
  111.     s->coded_height= height;
  112.     s->width = -((-width )>>s->lowres);
  113.     s->height= -((-height)>>s->lowres);
           ^
  114. }
  115. 

libavcodec/utils.c:114:1: return from a call to avcodec_set_dimensions
  112.     s->width = -((-width )>>s->lowres);
  113.     s->height= -((-height)>>s->lowres);
  114. }
       ^
  115. 
  116. typedef struct InternalBuffer{

libavcodec/vp8.c:215:5: 
213.     avcodec_set_dimensions(s->avctx, width, height);
214. 
215.     s->mb_width  = (s->avctx->coded_width +15) / 16;
         ^
216.     s->mb_height = (s->avctx->coded_height+15) / 16;
217. 

libavcodec/vp8.c:216:5: 
214. 
215.     s->mb_width  = (s->avctx->coded_width +15) / 16;
216.     s->mb_height = (s->avctx->coded_height+15) / 16;
         ^
217. 
218.     // we allocate a border around the top/left of intra4x4 modes

libavcodec/vp8.c:220:5: 
218.     // we allocate a border around the top/left of intra4x4 modes
219.     // this is 4 blocks for intra4x4 to keep 4-byte alignment for fill_rectangle
220.     s->mb_stride = s->mb_width+1;
         ^
221.     s->b4_stride = 4*s->mb_stride;
222. 

libavcodec/vp8.c:221:5: 
219.     // this is 4 blocks for intra4x4 to keep 4-byte alignment for fill_rectangle
220.     s->mb_stride = s->mb_width+1;
221.     s->b4_stride = 4*s->mb_stride;
         ^
222. 
223.     s->macroblocks_base        = av_mallocz(s->mb_stride*(s->mb_height+1)*sizeof(*s->macroblocks));

libavcodec/vp8.c:223:5: 
221.     s->b4_stride = 4*s->mb_stride;
222. 
223.     s->macroblocks_base        = av_mallocz(s->mb_stride*(s->mb_height+1)*sizeof(*s->macroblocks));
         ^
224.     s->intra4x4_pred_mode_base = av_mallocz(s->b4_stride*(4*s->mb_height+1));
225.     s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));

libavutil/mem.c:157:1: start of procedure av_mallocz()
  155. }
  156. 
  157. void *av_mallocz(unsigned int size)
       ^
  158. {
  159.     void *ptr = av_malloc(size);

libavutil/mem.c:159:5: 
  157. void *av_mallocz(unsigned int size)
  158. {
  159.     void *ptr = av_malloc(size);
           ^
  160.     if (ptr)
  161.         memset(ptr, 0, size);

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)

libavutil/mem.c:160:9: Taking false branch
  158. {
  159.     void *ptr = av_malloc(size);
  160.     if (ptr)
               ^
  161.         memset(ptr, 0, size);
  162.     return ptr;

libavutil/mem.c:162:5: 
  160.     if (ptr)
  161.         memset(ptr, 0, size);
  162.     return ptr;
           ^
  163. }
  164. 

libavutil/mem.c:163:1: return from a call to av_mallocz
  161.         memset(ptr, 0, size);
  162.     return ptr;
  163. }
       ^
  164. 
  165. char *av_strdup(const char *s)

libavcodec/vp8.c:224:5: 
222. 
223.     s->macroblocks_base        = av_mallocz(s->mb_stride*(s->mb_height+1)*sizeof(*s->macroblocks));
224.     s->intra4x4_pred_mode_base = av_mallocz(s->b4_stride*(4*s->mb_height+1));
         ^
225.     s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
226. 

libavutil/mem.c:157:1: start of procedure av_mallocz()
  155. }
  156. 
  157. void *av_mallocz(unsigned int size)
       ^
  158. {
  159.     void *ptr = av_malloc(size);

libavutil/mem.c:159:5: 
  157. void *av_mallocz(unsigned int size)
  158. {
  159.     void *ptr = av_malloc(size);
           ^
  160.     if (ptr)
  161.         memset(ptr, 0, size);

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)

libavutil/mem.c:160:9: Taking false branch
  158. {
  159.     void *ptr = av_malloc(size);
  160.     if (ptr)
               ^
  161.         memset(ptr, 0, size);
  162.     return ptr;

libavutil/mem.c:162:5: 
  160.     if (ptr)
  161.         memset(ptr, 0, size);
  162.     return ptr;
           ^
  163. }
  164. 

libavutil/mem.c:163:1: return from a call to av_mallocz
  161.         memset(ptr, 0, size);
  162.     return ptr;
  163. }
       ^
  164. 
  165. char *av_strdup(const char *s)

libavcodec/vp8.c:225:5: 
223.     s->macroblocks_base        = av_mallocz(s->mb_stride*(s->mb_height+1)*sizeof(*s->macroblocks));
224.     s->intra4x4_pred_mode_base = av_mallocz(s->b4_stride*(4*s->mb_height+1));
225.     s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
         ^
226. 
227.     s->macroblocks        = s->macroblocks_base        + 1 + s->mb_stride;

libavutil/mem.c:157:1: start of procedure av_mallocz()
  155. }
  156. 
  157. void *av_mallocz(unsigned int size)
       ^
  158. {
  159.     void *ptr = av_malloc(size);

libavutil/mem.c:159:5: 
  157. void *av_mallocz(unsigned int size)
  158. {
  159.     void *ptr = av_malloc(size);
           ^
  160.     if (ptr)
  161.         memset(ptr, 0, size);

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)

libavutil/mem.c:160:9: Taking false branch
  158. {
  159.     void *ptr = av_malloc(size);
  160.     if (ptr)
               ^
  161.         memset(ptr, 0, size);
  162.     return ptr;

libavutil/mem.c:162:5: 
  160.     if (ptr)
  161.         memset(ptr, 0, size);
  162.     return ptr;
           ^
  163. }
  164. 

libavutil/mem.c:163:1: return from a call to av_mallocz
  161.         memset(ptr, 0, size);
  162.     return ptr;
  163. }
       ^
  164. 
  165. char *av_strdup(const char *s)

libavcodec/vp8.c:227:5: 
225.     s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
226. 
227.     s->macroblocks        = s->macroblocks_base        + 1 + s->mb_stride;
         ^
228.     s->intra4x4_pred_mode = s->intra4x4_pred_mode_base + 4 + s->b4_stride;
229. 

libavcodec/vp8.c:228:5: 
226. 
227.     s->macroblocks        = s->macroblocks_base        + 1 + s->mb_stride;
228.     s->intra4x4_pred_mode = s->intra4x4_pred_mode_base + 4 + s->b4_stride;
         ^
229. 
230.     memset(s->intra4x4_pred_mode_base, DC_PRED, s->b4_stride);

libavcodec/vp8.c:230:5: 
228.     s->intra4x4_pred_mode = s->intra4x4_pred_mode_base + 4 + s->b4_stride;
229. 
230.     memset(s->intra4x4_pred_mode_base, DC_PRED, s->b4_stride);
         ^
231.     for (i = 0; i < 4*s->mb_height; i++)
232.         s->intra4x4_pred_mode[i*s->b4_stride-1] = DC_PRED;

static int update_dimensions(VP8Context *s, int width, int height)
{
    int i;
    if (avcodec_check_dimensions(s->avctx, width, height))
        return AVERROR_INVALIDDATA;
    vp8_decode_flush(s->avctx);
    avcodec_set_dimensions(s->avctx, width, height);
    s->mb_width  = (s->avctx->coded_width +15) / 16;
    s->mb_height = (s->avctx->coded_height+15) / 16;
    s->mb_stride = s->mb_width+1;
    s->b4_stride = 4*s->mb_stride;
    s->macroblocks_base        = av_mallocz(s->mb_stride*(s->mb_height+1)*sizeof(*s->macroblocks));
    s->intra4x4_pred_mode_base = av_mallocz(s->b4_stride*(4*s->mb_height+1));
    s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));
    s->macroblocks        = s->macroblocks_base        + 1 + s->mb_stride;
    s->intra4x4_pred_mode = s->intra4x4_pred_mode_base + 4 + s->b4_stride;
    memset(s->intra4x4_pred_mode_base, DC_PRED, s->b4_stride);
    for (i = 0; i < 4*s->mb_height; i++)
        s->intra4x4_pred_mode[i*s->b4_stride-1] = DC_PRED;
    return 0;
}
['static int update_dimensions(VP8Context *s, int width, int height)\n{\n    int i;\n    if (avcodec_check_dimensions(s->avctx, width, height))\n        return AVERROR_INVALIDDATA;\n    vp8_decode_flush(s->avctx);\n    avcodec_set_dimensions(s->avctx, width, height);\n    s->mb_width  = (s->avctx->coded_width +15) / 16;\n    s->mb_height = (s->avctx->coded_height+15) / 16;\n    s->mb_stride = s->mb_width+1;\n    s->b4_stride = 4*s->mb_stride;\n    s->macroblocks_base        = av_mallocz(s->mb_stride*(s->mb_height+1)*sizeof(*s->macroblocks));\n    s->intra4x4_pred_mode_base = av_mallocz(s->b4_stride*(4*s->mb_height+1));\n    s->top_nnz                 = av_mallocz(s->mb_width*sizeof(*s->top_nnz));\n    s->macroblocks        = s->macroblocks_base        + 1 + s->mb_stride;\n    s->intra4x4_pred_mode = s->intra4x4_pred_mode_base + 4 + s->b4_stride;\n    memset(s->intra4x4_pred_mode_base, DC_PRED, s->b4_stride);\n    for (i = 0; i < 4*s->mb_height; i++)\n        s->intra4x4_pred_mode[i*s->b4_stride-1] = DC_PRED;\n    return 0;\n}', 'int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){\n    if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)\n        return 0;\n    av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\\n", w, h);\n    return AVERROR(EINVAL);\n}', 'void avcodec_set_dimensions(AVCodecContext *s, int width, int height){\n    s->coded_width = width;\n    s->coded_height= height;\n    s->width = -((-width )>>s->lowres);\n    s->height= -((-height)>>s->lowres);\n}', 'void *av_mallocz(unsigned int size)\n{\n    void *ptr = av_malloc(size);\n    if (ptr)\n        memset(ptr, 0, size);\n    return ptr;\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}']