libavcodec/rawenc.c:41: 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 41, 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            = avctx->priv_data;

libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get()
  1505. }
  1506. 
  1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
        ^
  1508. {
  1509.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)

libavutil/pixdesc.c:1509:9: Taking false branch
  1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1508. {
  1509.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                ^
  1510.         return NULL;
  1511.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1509:24: Taking true branch
  1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1508. {
  1509.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                               ^
  1510.         return NULL;
  1511.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1510:9: 
  1508. {
  1509.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  1510.         return NULL;
                ^
  1511.     return &av_pix_fmt_descriptors[pix_fmt];
  1512. }

libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get
  1510.         return NULL;
  1511.     return &av_pix_fmt_descriptors[pix_fmt];
  1512. }
        ^
  1513. 
  1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)

libavcodec/rawenc.c:38:5: 
36.     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
37. 
38.     avctx->coded_frame            = avctx->priv_data;
        ^
39.     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
40.     avctx->coded_frame->key_frame = 1;

libavcodec/rawenc.c:39:5: 
37. 
38.     avctx->coded_frame            = avctx->priv_data;
39.     avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
        ^
40.     avctx->coded_frame->key_frame = 1;
41.     avctx->bits_per_coded_sample = av_get_bits_per_pixel(desc);

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

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

libavutil/pixdesc.c:1480:1: start of procedure av_get_bits_per_pixel()
  1478. }
  1479. 
  1480. int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
        ^
  1481. {
  1482.     int c, bits = 0;

libavutil/pixdesc.c:1482:5: 
  1480. int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
  1481. {
  1482.     int c, bits = 0;
            ^
  1483.     int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
  1484. 

libavutil/pixdesc.c:1483:5: 
  1481. {
  1482.     int c, bits = 0;
  1483.     int log2_pixels = pixdesc->log2_chroma_w + pixdesc->log2_chroma_h;
            ^
  1484. 
  1485.     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            = avctx->priv_data;
    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            = avctx->priv_data;\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}']