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

Zhao Zhili wantlamy at gmail.com
Tue Jul 18 08:59:40 CEST 2017


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

-- 
2.7.4
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170718/900e48dc/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-demux-adaptive-fix-out-of-range-exception.patch
Type: application/octet-stream
Size: 1283 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20170718/900e48dc/attachment.obj>


More information about the vlc-devel mailing list