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

Zhao Zhili wantlamy at gmail.com
Thu Jul 20 03:32:38 CEST 2017


On Tue, Jul 18, 2017 at 2:59 PM, Zhao Zhili <wantlamy at gmail.com> wrote:

> ---
>  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();
>

Ping for review.

As of now, value > line.size() is always false. Should I remove this check
or not?


> +            onHeader(line.substr(0, split), line.substr(value));
> +        }
>
> -        onHeader(line.substr(0, split), line.substr(value));
>          line = readLine();
>      }
>
> --
> 2.7.4
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170720/219c86ae/attachment.html>


More information about the vlc-devel mailing list