[vlc-commits] demux: adaptive: fix out of range exception

Zhao Zhili git at videolan.org
Wed Oct 18 20:20:32 CEST 2017


vlc | branch: master | Zhao Zhili <quinkblack at foxmail.com> | Thu Oct 12 16:04:02 2017 +0800| [284a8792b4945a5a6d83948caaf0b9dbd1a64418] | committer: Francois Cartegnie

demux: adaptive: fix out of range exception

Fixes #18611

Signed-off-by: Francois Cartegnie <fcvlcdev at free.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=284a8792b4945a5a6d83948caaf0b9dbd1a64418
---

 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 6fb2093a2f..f68bdab7c4 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();
         }



More information about the vlc-commits mailing list