libavcodec/dump_extradata_bsf.c:38: error: Null Dereference
  pointer `*poutbuf` last assigned on line 36 could be null and is dereferenced by call to `memcpy()` at line 38, column 13.

libavcodec/dump_extradata_bsf.c:24:1: start of procedure dump_extradata()
22. 
23. 
24. static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
    ^
25.                      uint8_t **poutbuf, int *poutbuf_size,
26.                      const uint8_t *buf, int buf_size, int keyframe){

libavcodec/dump_extradata_bsf.c:27:14: Condition is true
25.                      uint8_t **poutbuf, int *poutbuf_size,
26.                      const uint8_t *buf, int buf_size, int keyframe){
27.     int cmd= args ? *args : 0;
                 ^
28.     /* cast to avoid warning about discarding qualifiers */
29.     if(avctx->extradata){

libavcodec/dump_extradata_bsf.c:27:5: 
25.                      uint8_t **poutbuf, int *poutbuf_size,
26.                      const uint8_t *buf, int buf_size, int keyframe){
27.     int cmd= args ? *args : 0;
        ^
28.     /* cast to avoid warning about discarding qualifiers */
29.     if(avctx->extradata){

libavcodec/dump_extradata_bsf.c:29:8: Taking true branch
27.     int cmd= args ? *args : 0;
28.     /* cast to avoid warning about discarding qualifiers */
29.     if(avctx->extradata){
           ^
30.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
31.            ||(keyframe && (cmd=='k' || !cmd))

libavcodec/dump_extradata_bsf.c:30:15: Taking false branch
28.     /* cast to avoid warning about discarding qualifiers */
29.     if(avctx->extradata){
30.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
                  ^
31.            ||(keyframe && (cmd=='k' || !cmd))
32.            ||(cmd=='e')

libavcodec/dump_extradata_bsf.c:31:15: Taking false branch
29.     if(avctx->extradata){
30.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
31.            ||(keyframe && (cmd=='k' || !cmd))
                  ^
32.            ||(cmd=='e')
33.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){

libavcodec/dump_extradata_bsf.c:32:15: Taking true branch
30.         if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
31.            ||(keyframe && (cmd=='k' || !cmd))
32.            ||(cmd=='e')
                  ^
33.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
34.             int size= buf_size + avctx->extradata_size;

libavcodec/dump_extradata_bsf.c:34:13: 
32.            ||(cmd=='e')
33.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
34.             int size= buf_size + avctx->extradata_size;
                ^
35.             *poutbuf_size= size;
36.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);

libavcodec/dump_extradata_bsf.c:35:13: 
33.             /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
34.             int size= buf_size + avctx->extradata_size;
35.             *poutbuf_size= size;
                ^
36.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
37. 

libavcodec/dump_extradata_bsf.c:36:13: 
34.             int size= buf_size + avctx->extradata_size;
35.             *poutbuf_size= size;
36.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
                ^
37. 
38.             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);

libavutil/mem.c:43:1: start of procedure av_malloc()
  41.    linker will do it automatically */
  42. 
  43. void *av_malloc(unsigned int size)
      ^
  44. {
  45.     void *ptr = NULL;

libavutil/mem.c:45:5: 
  43. void *av_malloc(unsigned int size)
  44. {
  45.     void *ptr = NULL;
          ^
  46. #ifdef CONFIG_MEMALIGN_HACK
  47.     long diff;

libavutil/mem.c:51:8: Taking true branch
  49. 
  50.     /* let's disallow possible ambiguous cases */
  51.     if(size > (INT_MAX-16) )
             ^
  52.         return NULL;
  53. 

libavutil/mem.c:52:9: 
  50.     /* let's disallow possible ambiguous cases */
  51.     if(size > (INT_MAX-16) )
  52.         return NULL;
              ^
  53. 
  54. #ifdef CONFIG_MEMALIGN_HACK

libavutil/mem.c:95:1: return from a call to av_malloc
  93. #endif
  94.     return ptr;
  95. }
      ^
  96. 
  97. void *av_realloc(void *ptr, unsigned int size)

libavcodec/dump_extradata_bsf.c:38:13: 
36.             *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
37. 
38.             memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
                ^
39.             memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
40.             return 1;

static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,
                     uint8_t **poutbuf, int *poutbuf_size,
                     const uint8_t *buf, int buf_size, int keyframe){
    int cmd= args ? *args : 0;
    if(avctx->extradata){
        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')
           ||(keyframe && (cmd=='k' || !cmd))
           ||(cmd=='e')
             ){
            int size= buf_size + avctx->extradata_size;
            *poutbuf_size= size;
            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
            return 1;
        }
    }
    return 0;
}
["static int dump_extradata(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args,\n                     uint8_t **poutbuf, int *poutbuf_size,\n                     const uint8_t *buf, int buf_size, int keyframe){\n    int cmd= args ? *args : 0;\n    if(avctx->extradata){\n        if(  (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER) && cmd=='a')\n           ||(keyframe && (cmd=='k' || !cmd))\n           ||(cmd=='e')\n             ){\n            int size= buf_size + avctx->extradata_size;\n            *poutbuf_size= size;\n            *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);\n            memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);\n            memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size + FF_INPUT_BUFFER_PADDING_SIZE);\n            return 1;\n        }\n    }\n    return 0;\n}", 'void *av_malloc(unsigned int size)\n{\n    void *ptr = NULL;\n#ifdef CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if(size > (INT_MAX-16) )\n        return NULL;\n#ifdef 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 defined (HAVE_POSIX_MEMALIGN)\n    posix_memalign(&ptr,16,size);\n#elif defined (HAVE_MEMALIGN)\n    ptr = memalign(16,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']