[vlc-devel] [PATCH 1/2] demux: adaptive: fix out of range exception
Zhao Zhili
quinkblack at foxmail.com
Fri Oct 13 04:01:40 CEST 2017
Fixes #18611
---
modules/demux/adaptive/http/HTTPConnection.cpp | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp
b/modules/demux/adaptive/http/HTTPConnection.cpp
index 5934fb7..a1f81b6 100644
--- a/modules/demux/adaptive/http/HTTPConnection.cpp
+++ b/modules/demux/adaptive/http/HTTPConnection.cpp
@@ -246,10 +246,9 @@ int HTTPConnection::parseReply()
size_t split = lines.find_first_of(':');
if(split != std::string::npos)
{
- size_t value = split + 1;
- while(lines.at(value) == ' ')
- value++;
-
+ size_t value = lines.find_first_not_of(' ', split + 1);
+ if(value == std::string::npos)
+ value = lines.length();
onHeader(lines.substr(0, split), lines.substr(value));
lines = std::string();
}
--
2.7.4
On 2017年10月13日 06:25, Jean-Baptiste Kempf wrote:
> Does this patch close a known bug? Can you mention it in the commit log?
>
> On Thu, 12 Oct 2017, at 01:11, Zhao Zhili wrote:
>> ---
>> modules/demux/adaptive/http/HTTPConnection.cpp | 7 +++----
>> 1 file changed, 3 insertions(+), 4 deletions(-)
>>
>> diff --git a/modules/demux/adaptive/http/HTTPConnection.cpp
>> b/modules/demux/adaptive/http/HTTPConnection.cpp
>> index 5934fb7270..a1f81b61d8 100644
>> --- a/modules/demux/adaptive/http/HTTPConnection.cpp
>> +++ b/modules/demux/adaptive/http/HTTPConnection.cpp
>> @@ -246,10 +246,9 @@ int HTTPConnection::parseReply()
>> size_t split = lines.find_first_of(':');
>> if(split != std::string::npos)
>> {
>> - size_t value = split + 1;
>> - while(lines.at(value) == ' ')
>> - value++;
>> -
>> + size_t value = lines.find_first_not_of(' ', split + 1);
>> + if(value == std::string::npos)
>> + value = lines.length();
>> onHeader(lines.substr(0, split), lines.substr(value));
>> lines = std::string();
>> }
>> --
>> 2.14.2
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
>> Email had 1 attachment:
>> + 0001-demux-adaptive-fix-out-of-range-exception.patch
>> 2k (text/plain)
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-adaptive-fix-out-of-range-exception.patch
Type: text/x-patch
Size: 1131 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20171013/20b76ace/attachment.bin>
More information about the vlc-devel
mailing list