libavcodec/rawenc.c:44: error: Null Dereference
  pointer `desc` last assigned on line 36 could be null and is dereferenced by call to `av_get_bits_per_pixel()` at line 44, column 36.

libavcodec/rawenc.c:34:1: start of procedure raw_encode_init()
32. #include "libavutil/internal.h"
33. 
34. static av_cold int raw_encode_init(AVCodecContext *avctx)
    ^
35. {
36.     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);

libavcodec/rawenc.c:36:5: 
34. static av_cold int raw_encode_init(AVCodecContext *avctx)
35. {
36.     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
        ^
37. 
38.     avctx->coded_frame            = av_frame_alloc();

libavutil/pixdesc.c:1676:1: start of procedure av_pix_fmt_desc_get()
  1674. }
  1675. 
  1676. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
        ^
  1677. {
  1678.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)

libavutil/pixdesc.c:1678:9: Taking false branch
  1676. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1677. {
  1678.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                ^
  1679.         return NULL;
  1680.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1678:24: Taking true branch
  1676. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1677. {
  1678.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                               ^
  1679.         return NULL;
  1680.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1679:9: 
  1677. {
  1678.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  1679.         return NULL;
                ^
  1680.     return &av_pix_fmt_descriptors[pix_fmt];
  1681. }

libavutil/pixdesc.c:1681:1: return from a call to av_pix_fmt_desc_get
  1679.         return NULL;
  1680.     return &av_pix_fmt_descriptors[pix_fmt];
  1681. }
        ^
  1682. 
  1683. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)

libavcodec/rawenc.c:38:5: Skipping av_frame_alloc(): empty list of specs
36.     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
37. 
38.     avctx->coded_frame            = av_frame_alloc();
        ^
39.     if (!avctx->coded_frame)
40.         return AVERROR(ENOMEM);

libavcodec/rawenc.c:39:10: Taking false branch
37. 
38.     avctx->coded_frame            = av_frame_alloc();
39.     if (!avctx->coded_frame)
             ^
40.         return AVERROR(ENOMEM);
41. 

libavcodec/rawenc.c:42:5: 
40.         return AVERROR(ENOMEM);
41. 
42.     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
        ^
43.     avctx->coded_frame->key_frame = 1;
44.     avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);

libavcodec/rawenc.c:43:5: 
41. 
42.     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
43.     avctx->coded_frame->key_frame = 1;
        ^
44.     avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
45.     if(!avctx->codec_tag)

libavcodec/rawenc.c:44:5: 
42.     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
43.     avctx->coded_frame->key_frame = 1;
44.     avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
        ^
45.     if(!avctx->codec_tag)
46.         avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);

libavutil/pixdesc.c:1648:1: start of procedure av_get_bits_per_pixel()
  1646. }
  1647. 
  1648. int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
        ^
  1649. {
  1650.     int c, bits = 0;

libavutil/pixdesc.c:1650:5: 
  1648. int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
  1649. {
  1650.     int c, bits = 0;
            ^
  1651.     int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
  1652. 

libavutil/pixdesc.c:1651:5: 
  1649. {
  1650.     int c, bits = 0;
  1651.     int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
            ^
  1652. 
  1653.     for (c = 0; c < pixdesc->nb_components; c++) {

static av_cold int raw_encode_init(AVCodecContext *avctx)
{
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
    avctx->coded_frame            = av_frame_alloc();
    if (!avctx->coded_frame)
        return AVERROR(ENOMEM);
    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
    avctx->coded_frame->key_frame = 1;
    avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);
    if(!avctx->codec_tag)
        avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);
    return 0;
}
['static av_cold int raw_encode_init(AVCodecContext *avctx)\n{\n    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n    avctx->coded_frame            = av_frame_alloc();\n    if (!avctx->coded_frame)\n        return AVERROR(ENOMEM);\n    avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;\n    avctx->coded_frame->key_frame = 1;\n    avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);\n    if(!avctx->codec_tag)\n        avctx->codec_tag = avcodec_pix_fmt_to_codec_tag(avctx->pix_fmt);\n    return 0;\n}', 'const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)\n{\n    if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)\n        return NULL;\n    return &av_pix_fmt_descriptors[pix_fmt];\n}', 'int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)\n{\n    int c, bits = 0;\n    int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;\n    for (c = 0; c < pixdesc->nb_components; c++) {\n        int s = c == 1 || c == 2 ? 0 : log2_pixels;\n        bits += (pixdesc->comp[c].depth_minus1 + 1) << s;\n    }\n    return bits >> log2_pixels;\n}']