Message ID | 20210118062208.85568-1-liuqi05@kuaishou.com |
---|---|
State | Accepted |
Commit | 756897eff4950ad0c969b891d7c4af5df0406c25 |
Headers | show |
Series | [FFmpeg-devel,v2,1/2] avformat/dashdec: check init_section before use it. | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
andriy/PPC64_make | success | Make finished |
andriy/PPC64_make_fate | success | Make fate finished |
> 2021年1月18日 下午2:22,liuqi05 <liuqi05@kuaishou.com> 写道: > > because there have no Initialization in SegmentTemplate, > so it will have no init_section for init segment file. > but in the is_common_init_section_exist function it will be used for > check to url, url_offset and size, so check init_section > before use init_section. > And fix code style in is_common_init_section_exist, > make the code block short when it too long. > > fix ticket: 9062 > > Signed-off-by: liuqi05 <liuqi05@kuaishou.com> > --- > libavformat/dashdec.c | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c > index 693fc7372b..9262e9c0a4 100644 > --- a/libavformat/dashdec.c > +++ b/libavformat/dashdec.c > @@ -1992,7 +1992,12 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls) > url_offset = first_init_section->url_offset; > size = pls[0]->init_section->size; > for (i=0;i<n_pls;i++) { > - if (av_strcasecmp(pls[i]->init_section->url,url) || pls[i]->init_section->url_offset != url_offset || pls[i]->init_section->size != size) { > + if (!pls[i]->init_section) > + continue; > + > + if (av_strcasecmp(pls[i]->init_section->url, url) || > + pls[i]->init_section->url_offset != url_offset || > + pls[i]->init_section->size != size) { > return 0; > } > } > -- > 2.25.0 > > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". Ping. Thanks Steven Liu
diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c index 693fc7372b..9262e9c0a4 100644 --- a/libavformat/dashdec.c +++ b/libavformat/dashdec.c @@ -1992,7 +1992,12 @@ static int is_common_init_section_exist(struct representation **pls, int n_pls) url_offset = first_init_section->url_offset; size = pls[0]->init_section->size; for (i=0;i<n_pls;i++) { - if (av_strcasecmp(pls[i]->init_section->url,url) || pls[i]->init_section->url_offset != url_offset || pls[i]->init_section->size != size) { + if (!pls[i]->init_section) + continue; + + if (av_strcasecmp(pls[i]->init_section->url, url) || + pls[i]->init_section->url_offset != url_offset || + pls[i]->init_section->size != size) { return 0; } }
because there have no Initialization in SegmentTemplate, so it will have no init_section for init segment file. but in the is_common_init_section_exist function it will be used for check to url, url_offset and size, so check init_section before use init_section. And fix code style in is_common_init_section_exist, make the code block short when it too long. fix ticket: 9062 Signed-off-by: liuqi05 <liuqi05@kuaishou.com> --- libavformat/dashdec.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)