Message ID | 20220826025016.29627-1-lq@chinaffmpeg.org |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,1/2] avformat/imfdec: check track valid before use it | expand |
Since we are protecting against the algorithm within get_next_track_with_minimum_timestamp() return NULL, should this patch also include immediately returning from imf_read_packet() if get_next_track_with_minimum_timestamp() returns NULL? On Thu, Aug 25, 2022 at 7:53 PM Steven Liu <lq@chinaffmpeg.org> wrote: > > fix CID: 1512414 > > Signed-off-by: Steven Liu <lq@chinaffmpeg.org> > --- > libavformat/imfdec.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c > index 5bbe7a53f8..a97dcc3b8b 100644 > --- a/libavformat/imfdec.c > +++ b/libavformat/imfdec.c > @@ -697,8 +697,9 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma > } > } > > - av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", > - track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); > + if (track) > + av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", > + track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); > return track; > } > > -- > 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".
Pierre-Anthony Lemieux <pal@sandflow.com> 于2022年8月26日周五 11:52写道: > > Since we are protecting against the algorithm within > get_next_track_with_minimum_timestamp() return NULL, should this patch > also include immediately returning from imf_read_packet() if > get_next_track_with_minimum_timestamp() returns NULL? What about return AVERROR_INVALIDDATA in imf_read_packet? > > On Thu, Aug 25, 2022 at 7:53 PM Steven Liu <lq@chinaffmpeg.org> wrote: > > > > fix CID: 1512414 > > > > Signed-off-by: Steven Liu <lq@chinaffmpeg.org> > > --- > > libavformat/imfdec.c | 5 +++-- > > 1 file changed, 3 insertions(+), 2 deletions(-) > > > > diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c > > index 5bbe7a53f8..a97dcc3b8b 100644 > > --- a/libavformat/imfdec.c > > +++ b/libavformat/imfdec.c > > @@ -697,8 +697,9 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma > > } > > } > > > > - av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", > > - track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); > > + if (track) > > + av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", > > + track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); > > return track; > > } > > > > -- > > 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". > _______________________________________________ > 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".
diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index 5bbe7a53f8..a97dcc3b8b 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -697,8 +697,9 @@ static IMFVirtualTrackPlaybackCtx *get_next_track_with_minimum_timestamp(AVForma } } - av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", - track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); + if (track) + av_log(s, AV_LOG_DEBUG, "Found next track to read: %d (timestamp: %lf / %lf)\n", + track->index, av_q2d(track->current_timestamp), av_q2d(minimum_timestamp)); return track; }
fix CID: 1512414 Signed-off-by: Steven Liu <lq@chinaffmpeg.org> --- libavformat/imfdec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)