[vlc-devel] [PATCH 1/2] demux: adaptive: fix out of range exception
Rémi Denis-Courmont
remi at remlab.net
Mon Jul 24 18:34:23 CEST 2017
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.
--
雷米‧德尼-库尔蒙
https://www.remlab.net/
More information about the vlc-devel
mailing list