libavcodec/assdec.c:34: error: Null Dereference
  pointer `avctx->subtitle_header` last assigned on line 31 could be null and is dereferenced by call to `memcpy()` at line 34, column 5.

libavcodec/assdec.c:29:1: start of procedure ass_decode_init()
27. #include "libavutil/mem.h"
28. 
29. static av_cold int ass_decode_init(AVCodecContext *avctx)
    ^
30. {
31.     avctx->subtitle_header = av_malloc(avctx->extradata_size);

libavcodec/assdec.c:31:5: 
29. static av_cold int ass_decode_init(AVCodecContext *avctx)
30. {
31.     avctx->subtitle_header = av_malloc(avctx->extradata_size);
        ^
32.     if (!avctx->extradata)
33.         return AVERROR(ENOMEM);

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

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

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

libavutil/mem.c:73:9: 
  71.     /* let's disallow possible ambiguous cases */
  72.     if (size > (INT_MAX-32) || !size)
  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, size_t size)

libavcodec/assdec.c:32:10: Taking false branch
30. {
31.     avctx->subtitle_header = av_malloc(avctx->extradata_size);
32.     if (!avctx->extradata)
             ^
33.         return AVERROR(ENOMEM);
34.     memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);

libavcodec/assdec.c:34:5: 
32.     if (!avctx->extradata)
33.         return AVERROR(ENOMEM);
34.     memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
        ^
35.     avctx->subtitle_header_size = avctx->extradata_size;
36.     return 0;

static av_cold int ass_decode_init(AVCodecContext *avctx)
{
    avctx->subtitle_header = av_malloc(avctx->extradata_size);
    if (!avctx->extradata)
        return AVERROR(ENOMEM);
    memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);
    avctx->subtitle_header_size = avctx->extradata_size;
    return 0;
}
['static av_cold int ass_decode_init(AVCodecContext *avctx)\n{\n    avctx->subtitle_header = av_malloc(avctx->extradata_size);\n    if (!avctx->extradata)\n        return AVERROR(ENOMEM);\n    memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size);\n    avctx->subtitle_header_size = avctx->extradata_size;\n    return 0;\n}', 'void *av_malloc(size_t size)\n{\n    void *ptr = NULL;\n#if CONFIG_MEMALIGN_HACK\n    long diff;\n#endif\n    if (size > (INT_MAX-32) || !size)\n        return NULL;\n#if CONFIG_MEMALIGN_HACK\n    ptr = malloc(size+32);\n    if(!ptr)\n        return ptr;\n    diff= ((-(long)ptr - 1)&31) + 1;\n    ptr = (char*)ptr + diff;\n    ((char*)ptr)[-1]= diff;\n#elif HAVE_POSIX_MEMALIGN\n    if (posix_memalign(&ptr,32,size))\n        ptr = NULL;\n#elif HAVE_ALIGNED_MALLOC\n    ptr = _aligned_malloc(size, 32);\n#elif HAVE_MEMALIGN\n    ptr = memalign(32,size);\n#else\n    ptr = malloc(size);\n#endif\n    return ptr;\n}']