libavformat/dv.c:402: error: Null Dereference
  pointer `sys` last assigned on line 398 could be null and is dereferenced at line 402, column 40.

libavformat/dv.c:394:1: start of procedure dv_frame_offset()
392. }
393. 
394. static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
     ^
395.                                int64_t timestamp, int flags)
396. {

libavformat/dv.c:398:5: 
396. {
397.     // FIXME: sys may be wrong if last dv_read_packet() failed (buffer is junk)
398.     const AVDVProfile *sys = av_dv_codec_profile(c->vst->codec->width, c->vst->codec->height,
         ^
399.                                                  c->vst->codec->pix_fmt);
400.     int64_t offset;

libavcodec/dv_profile.c:296:1: start of procedure av_dv_codec_profile()
  294. }
  295. 
  296. const AVDVProfile *av_dv_codec_profile(int width, int height,
       ^
  297.                                        enum AVPixelFormat pix_fmt)
  298. {

libavcodec/dv_profile.c:302:10: 
  300.     int i;
  301. 
  302.     for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
                ^
  303.        if (height  == dv_profiles[i].height  &&
  304.            pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:302:15: Loop condition is true. Entering loop body
  300.     int i;
  301. 
  302.     for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
                     ^
  303.        if (height  == dv_profiles[i].height  &&
  304.            pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:303:12: Taking false branch
  301. 
  302.     for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
  303.        if (height  == dv_profiles[i].height  &&
                  ^
  304.            pix_fmt == dv_profiles[i].pix_fmt &&
  305.            width   == dv_profiles[i].width)

libavcodec/dv_profile.c:302:46: 
  300.     int i;
  301. 
  302.     for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
                                                    ^
  303.        if (height  == dv_profiles[i].height  &&
  304.            pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:302:15: Loop condition is false. Leaving loop
  300.     int i;
  301. 
  302.     for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)
                     ^
  303.        if (height  == dv_profiles[i].height  &&
  304.            pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:309:5: 
  307. #endif
  308. 
  309.     return NULL;
           ^
  310. }

libavcodec/dv_profile.c:310:1: return from a call to av_dv_codec_profile
  308. 
  309.     return NULL;
  310. }
       ^

libavformat/dv.c:401:5: 
399.                                                  c->vst->codec->pix_fmt);
400.     int64_t offset;
401.     int64_t size       = avio_size(s->pb) - s->data_offset;
         ^
402.     int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
403. 

libavformat/aviobuf.c:241:1: start of procedure avio_size()
  239. }
  240. 
  241. int64_t avio_size(AVIOContext *s)
       ^
  242. {
  243.     int64_t size;

libavformat/aviobuf.c:245:10: Taking false branch
  243.     int64_t size;
  244. 
  245.     if (!s)
                ^
  246.         return AVERROR(EINVAL);
  247. 

libavformat/aviobuf.c:248:10: Taking false branch
  246.         return AVERROR(EINVAL);
  247. 
  248.     if (!s->seek)
                ^
  249.         return AVERROR(ENOSYS);
  250.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);

libavformat/aviobuf.c:250:5: Skipping __function_pointer__(): unresolved function pointer
  248.     if (!s->seek)
  249.         return AVERROR(ENOSYS);
  250.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
           ^
  251.     if (size < 0) {
  252.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)

libavformat/aviobuf.c:251:9: Taking true branch
  249.         return AVERROR(ENOSYS);
  250.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
  251.     if (size < 0) {
               ^
  252.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
  253.             return size;

libavformat/aviobuf.c:252:13: Taking false branch
  250.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
  251.     if (size < 0) {
  252.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
                   ^
  253.             return size;
  254.         size++;

libavformat/aviobuf.c:254:9: 
  252.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
  253.             return size;
  254.         size++;
               ^
  255.         s->seek(s->opaque, s->pos, SEEK_SET);
  256.     }

libavformat/aviobuf.c:255:9: Skipping __function_pointer__(): unresolved function pointer
  253.             return size;
  254.         size++;
  255.         s->seek(s->opaque, s->pos, SEEK_SET);
               ^
  256.     }
  257.     return size;

libavformat/aviobuf.c:257:5: 
  255.         s->seek(s->opaque, s->pos, SEEK_SET);
  256.     }
  257.     return size;
           ^
  258. }
  259. 

libavformat/aviobuf.c:258:1: return from a call to avio_size
  256.     }
  257.     return size;
  258. }
       ^
  259. 
  260. void avio_wl32(AVIOContext *s, unsigned int val)

libavformat/dv.c:402:5: 
400.     int64_t offset;
401.     int64_t size       = avio_size(s->pb) - s->data_offset;
402.     int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
         ^
403. 
404.     offset = sys->frame_size * timestamp;

static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,
                               int64_t timestamp, int flags)
{
    const AVDVProfile *sys = av_dv_codec_profile(c->vst->codec->width, c->vst->codec->height,
                                                 c->vst->codec->pix_fmt);
    int64_t offset;
    int64_t size       = avio_size(s->pb) - s->data_offset;
    int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
    offset = sys->frame_size * timestamp;
    if (size >= 0 && offset > max_offset)
        offset = max_offset;
    else if (offset < 0)
        offset = 0;
    return offset + s->data_offset;
}
['static int64_t dv_frame_offset(AVFormatContext *s, DVDemuxContext *c,\n                               int64_t timestamp, int flags)\n{\n    const AVDVProfile *sys = av_dv_codec_profile(c->vst->codec->width, c->vst->codec->height,\n                                                 c->vst->codec->pix_fmt);\n    int64_t offset;\n    int64_t size       = avio_size(s->pb) - s->data_offset;\n    int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;\n    offset = sys->frame_size * timestamp;\n    if (size >= 0 && offset > max_offset)\n        offset = max_offset;\n    else if (offset < 0)\n        offset = 0;\n    return offset + s->data_offset;\n}', 'const AVDVProfile *av_dv_codec_profile(int width, int height,\n                                       enum AVPixelFormat pix_fmt)\n{\n#if CONFIG_DVPROFILE\n    int i;\n    for (i=0; i<FF_ARRAY_ELEMS(dv_profiles); i++)\n       if (height  == dv_profiles[i].height  &&\n           pix_fmt == dv_profiles[i].pix_fmt &&\n           width   == dv_profiles[i].width)\n           return &dv_profiles[i];\n#endif\n    return NULL;\n}', 'int64_t avio_size(AVIOContext *s)\n{\n    int64_t size;\n    if (!s)\n        return AVERROR(EINVAL);\n    if (!s->seek)\n        return AVERROR(ENOSYS);\n    size = s->seek(s->opaque, 0, AVSEEK_SIZE);\n    if (size < 0) {\n        if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)\n            return size;\n        size++;\n        s->seek(s->opaque, s->pos, SEEK_SET);\n    }\n    return size;\n}']