libavcodec/imgconvert.c:578: error: Null Dereference
  pointer `desc` last assigned on line 547 could be null and is dereferenced at line 578, column 13.

libavcodec/imgconvert.c:543:1: start of procedure avg_bits_per_pixel()
541. }
542. 
543. static int avg_bits_per_pixel(enum AVPixelFormat pix_fmt)
     ^
544. {
545.     int bits;

libavcodec/imgconvert.c:547:5: 
545.     int bits;
546.     const PixFmtInfo *pf;
547.     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
         ^
548. 
549.     pf = &pix_fmt_info[pix_fmt];

libavutil/pixdesc.c:1199:1: start of procedure av_pix_fmt_desc_get()
  1197. }
  1198. 
  1199. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
        ^
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)

libavutil/pixdesc.c:1201:9: Taking false branch
  1199. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                ^
  1202.         return NULL;
  1203.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1201:24: Taking true branch
  1199. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
                               ^
  1202.         return NULL;
  1203.     return &av_pix_fmt_descriptors[pix_fmt];

libavutil/pixdesc.c:1202:9: 
  1200. {
  1201.     if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
  1202.         return NULL;
                ^
  1203.     return &av_pix_fmt_descriptors[pix_fmt];
  1204. }

libavutil/pixdesc.c:1204:1: return from a call to av_pix_fmt_desc_get
  1202.         return NULL;
  1203.     return &av_pix_fmt_descriptors[pix_fmt];
  1204. }
        ^
  1205. 
  1206. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)

libavcodec/imgconvert.c:549:5: 
547.     const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
548. 
549.     pf = &pix_fmt_info[pix_fmt];
         ^
550.     switch(pf->pixel_type) {
551.     case FF_PIXEL_PACKED:

libavcodec/imgconvert.c:550:5: 
548. 
549.     pf = &pix_fmt_info[pix_fmt];
550.     switch(pf->pixel_type) {
         ^
551.     case FF_PIXEL_PACKED:
552.         switch(pix_fmt) {

libavcodec/imgconvert.c:551:5: Switch condition is false. Skipping switch case
549.     pf = &pix_fmt_info[pix_fmt];
550.     switch(pf->pixel_type) {
551.     case FF_PIXEL_PACKED:
         ^
552.         switch(pix_fmt) {
553.         case AV_PIX_FMT_YUYV422:

libavcodec/imgconvert.c:577:5: Switch condition is true. Entering switch case
575.         }
576.         break;
577.     case FF_PIXEL_PLANAR:
         ^
578.         if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {
579.             bits = pf->depth * pf->nb_channels;

libavcodec/imgconvert.c:578:13: 
576.         break;
577.     case FF_PIXEL_PLANAR:
578.         if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {
                 ^
579.             bits = pf->depth * pf->nb_channels;
580.         } else {

static int avg_bits_per_pixel(enum AVPixelFormat pix_fmt)
{
    int bits;
    const PixFmtInfo *pf;
    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
    pf = &pix_fmt_info[pix_fmt];
    switch(pf->pixel_type) {
    case FF_PIXEL_PACKED:
        switch(pix_fmt) {
        case AV_PIX_FMT_YUYV422:
        case AV_PIX_FMT_UYVY422:
        case AV_PIX_FMT_RGB565BE:
        case AV_PIX_FMT_RGB565LE:
        case AV_PIX_FMT_RGB555BE:
        case AV_PIX_FMT_RGB555LE:
        case AV_PIX_FMT_RGB444BE:
        case AV_PIX_FMT_RGB444LE:
        case AV_PIX_FMT_BGR565BE:
        case AV_PIX_FMT_BGR565LE:
        case AV_PIX_FMT_BGR555BE:
        case AV_PIX_FMT_BGR555LE:
        case AV_PIX_FMT_BGR444BE:
        case AV_PIX_FMT_BGR444LE:
            bits = 16;
            break;
        case AV_PIX_FMT_UYYVYY411:
            bits = 12;
            break;
        default:
            bits = pf->depth * pf->nb_channels;
            break;
        }
        break;
    case FF_PIXEL_PLANAR:
        if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {
            bits = pf->depth * pf->nb_channels;
        } else {
            bits = pf->depth + ((2 * pf->depth) >>
                                (desc->log2_chroma_w + desc->log2_chroma_h));
        }
        break;
    case FF_PIXEL_PALETTE:
        bits = 8;
        break;
    default:
        bits = -1;
        break;
    }
    return bits;
}
['static int avg_bits_per_pixel(enum AVPixelFormat pix_fmt)\n{\n    int bits;\n    const PixFmtInfo *pf;\n    const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);\n    pf = &pix_fmt_info[pix_fmt];\n    switch(pf->pixel_type) {\n    case FF_PIXEL_PACKED:\n        switch(pix_fmt) {\n        case AV_PIX_FMT_YUYV422:\n        case AV_PIX_FMT_UYVY422:\n        case AV_PIX_FMT_RGB565BE:\n        case AV_PIX_FMT_RGB565LE:\n        case AV_PIX_FMT_RGB555BE:\n        case AV_PIX_FMT_RGB555LE:\n        case AV_PIX_FMT_RGB444BE:\n        case AV_PIX_FMT_RGB444LE:\n        case AV_PIX_FMT_BGR565BE:\n        case AV_PIX_FMT_BGR565LE:\n        case AV_PIX_FMT_BGR555BE:\n        case AV_PIX_FMT_BGR555LE:\n        case AV_PIX_FMT_BGR444BE:\n        case AV_PIX_FMT_BGR444LE:\n            bits = 16;\n            break;\n        case AV_PIX_FMT_UYYVYY411:\n            bits = 12;\n            break;\n        default:\n            bits = pf->depth * pf->nb_channels;\n            break;\n        }\n        break;\n    case FF_PIXEL_PLANAR:\n        if (desc->log2_chroma_w == 0 && desc->log2_chroma_h == 0) {\n            bits = pf->depth * pf->nb_channels;\n        } else {\n            bits = pf->depth + ((2 * pf->depth) >>\n                                (desc->log2_chroma_w + desc->log2_chroma_h));\n        }\n        break;\n    case FF_PIXEL_PALETTE:\n        bits = 8;\n        break;\n    default:\n        bits = -1;\n        break;\n    }\n    return bits;\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}']