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

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

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

libavcodec/dv_profile.c:287:1: start of procedure av_dv_codec_profile()
  285. }
  286. 
  287. const AVDVProfile *av_dv_codec_profile(int width, int height,
       ^
  288.                                        enum AVPixelFormat pix_fmt)
  289. {

libavcodec/dv_profile.c:293:10: 
  291.     int i;
  292. 
  293.     for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
                ^
  294.         if (height  == dv_profiles[i].height  &&
  295.             pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:293:17: Loop condition is true. Entering loop body
  291.     int i;
  292. 
  293.     for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
                       ^
  294.         if (height  == dv_profiles[i].height  &&
  295.             pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:294:13: Taking false branch
  292. 
  293.     for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
  294.         if (height  == dv_profiles[i].height  &&
                   ^
  295.             pix_fmt == dv_profiles[i].pix_fmt &&
  296.             width   == dv_profiles[i].width)

libavcodec/dv_profile.c:293:50: 
  291.     int i;
  292. 
  293.     for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
                                                        ^
  294.         if (height  == dv_profiles[i].height  &&
  295.             pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:293:17: Loop condition is false. Leaving loop
  291.     int i;
  292. 
  293.     for (i = 0; i < FF_ARRAY_ELEMS(dv_profiles); i++)
                       ^
  294.         if (height  == dv_profiles[i].height  &&
  295.             pix_fmt == dv_profiles[i].pix_fmt &&

libavcodec/dv_profile.c:300:5: 
  298. #endif
  299. 
  300.     return NULL;
           ^
  301. }

libavcodec/dv_profile.c:301:1: return from a call to av_dv_codec_profile
  299. 
  300.     return NULL;
  301. }
       ^

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

libavformat/aviobuf.c:280:1: start of procedure avio_size()
  278. }
  279. 
  280. int64_t avio_size(AVIOContext *s)
       ^
  281. {
  282.     int64_t size;

libavformat/aviobuf.c:284:10: Taking false branch
  282.     int64_t size;
  283. 
  284.     if (!s)
                ^
  285.         return AVERROR(EINVAL);
  286. 

libavformat/aviobuf.c:287:10: Taking false branch
  285.         return AVERROR(EINVAL);
  286. 
  287.     if (!s->seek)
                ^
  288.         return AVERROR(ENOSYS);
  289.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);

libavformat/aviobuf.c:289:5: Skipping __function_pointer__(): unresolved function pointer
  287.     if (!s->seek)
  288.         return AVERROR(ENOSYS);
  289.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
           ^
  290.     if (size < 0) {
  291.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)

libavformat/aviobuf.c:290:9: Taking true branch
  288.         return AVERROR(ENOSYS);
  289.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
  290.     if (size < 0) {
               ^
  291.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
  292.             return size;

libavformat/aviobuf.c:291:13: Taking false branch
  289.     size = s->seek(s->opaque, 0, AVSEEK_SIZE);
  290.     if (size < 0) {
  291.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
                   ^
  292.             return size;
  293.         size++;

libavformat/aviobuf.c:293:9: 
  291.         if ((size = s->seek(s->opaque, -1, SEEK_END)) < 0)
  292.             return size;
  293.         size++;
               ^
  294.         s->seek(s->opaque, s->pos, SEEK_SET);
  295.     }

libavformat/aviobuf.c:294:9: Skipping __function_pointer__(): unresolved function pointer
  292.             return size;
  293.         size++;
  294.         s->seek(s->opaque, s->pos, SEEK_SET);
               ^
  295.     }
  296.     return size;

libavformat/aviobuf.c:296:5: 
  294.         s->seek(s->opaque, s->pos, SEEK_SET);
  295.     }
  296.     return size;
           ^
  297. }
  298. 

libavformat/aviobuf.c:297:1: return from a call to avio_size
  295.     }
  296.     return size;
  297. }
       ^
  298. 
  299. void avio_wl32(AVIOContext *s, unsigned int val)

libavformat/dv.c:401:5: 
399.     int64_t offset;
400.     int64_t size       = avio_size(s->pb) - s->internal->data_offset;
401.     int64_t max_offset = ((size - 1) / sys->frame_size) * sys->frame_size;
         ^
402. 
403.     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->codecpar->width, c->vst->codecpar->height,
                                                 c->vst->codecpar->format);
    int64_t offset;
    int64_t size       = avio_size(s->pb) - s->internal->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->internal->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->codecpar->width, c->vst->codecpar->height,\n                                                 c->vst->codecpar->format);\n    int64_t offset;\n    int64_t size       = avio_size(s->pb) - s->internal->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->internal->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}']