[vlc-devel] [PATCH 1/2] demux: adaptive: fix out of range exception

Zhao Zhili wantlamy at gmail.com
Tue Jul 25 03:40:07 CEST 2017


Hi Rémi,

On Tue, Jul 25, 2017 at 12:34 AM, Rémi Denis-Courmont <remi at remlab.net>
wrote:

> Le tiistaina 18. heinäkuuta 2017, 14.59.40 EEST Zhao Zhili a écrit :
> > ---
> >  modules/demux/adaptive/http/HTTPConnection.cpp | 14 ++++++++++----
> >  1 file changed, 10 insertions(+), 4 deletions(-)
> >
> > diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp
> > b/modules/demux/adaptive/http/HTTPConnection.cpp
> > index 03156c6..0ebbd18 100644
> > --- a/modules/demux/adaptive/http/HTTPConnection.cpp
> > +++ b/modules/demux/adaptive/http/HTTPConnection.cpp
> > @@ -241,12 +241,18 @@ int HTTPConnection::parseReply()
> >      while(!line.empty() && line.compare("\r\n"))
> >      {
> >          size_t split = line.find_first_of(':');
> > -        size_t value = split + 1;
> > +        if(split != std::string::npos)
> > +        {
> > +            size_t value = split + 1;
> > +
> > +            while(value < line.size() && line[value] == ' ')
> > +                value++;
> >
> > -        while(line.at(value) == ' ')
> > -            value++;
> > +            if(value > line.size())
> > +                value = line.size();
> > +            onHeader(line.substr(0, split), line.substr(value));
> > +        }
> >
> > -        onHeader(line.substr(0, split), line.substr(value));
> >          line = readLine();
> >      }
>
> The code is wrong, missing error handling. But the patch does not really
> seem
> to fix the real problem.
>
>
Thanks for your review! I'm trying to fix the most obvious bug which did
lead to crash during test.
Do you mind to give me a hint on what's the real problem?



> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170725/8703c5ea/attachment.html>


More information about the vlc-devel mailing list