[FFmpeg-devel] [PATCH] avformat/dashdec: check NULL pointer of av_strtok
Steven Liu
lingjiujianke at gmail.com
Fri Dec 27 16:15:51 EET 2024
Leo Izen <leo.izen at gmail.com> 于2024年12月27日周五 21:29写道:
Hi Leo,
>
> On 12/26/24 6:37 PM, Steven Liu wrote:
> > fix CID: 1637073
> > there maybe have NULL pointer return by av_strtok, and should be checked before
> > strtoll it.
> >
> > Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
> > ---
> > libavformat/dashdec.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
> > index 8107280444..043cd52232 100644
> > --- a/libavformat/dashdec.c
> > +++ b/libavformat/dashdec.c
> > @@ -589,6 +589,8 @@ static struct fragment *get_fragment(char *range)
> > if (range) {
> > char *str_end_offset;
> > char *str_offset = av_strtok(range, "-", &str_end_offset);
> > + if (!str_offset)
> > + return NULL;
> > seg->url_offset = strtoll(str_offset, NULL, 10);
> > seg->size = strtoll(str_end_offset, NULL, 10) - seg->url_offset + 1;
> > }
>
> If the range is invalid, do we want to return NULL? What if the range is
> a single integer, do we want to return that integer? What about
NULL will happen when range is "-";
But i think maybe it should av_free the seg here, is it?
> returning an empty segment struct (as though the range == NULL)? It
> looks fine for preventing a NULL dereference, I just want to check to
> make sure this behavior is desired if the "-" token is not found.
>
Thanks
Steven
More information about the ffmpeg-devel
mailing list