Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2014-03-30 01:58:53 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2014-03-30 02:00:07 +0400
commitd6e642ba6767e9074214839eb88a7452ca686835 (patch)
treeaa07458bb1c7300bb028e0bd3d23ab69a500d8b5 /common
parent97f09e5b69738d63c38dff58e9f1dab93c9574b8 (diff)
Validate string position before using the index.
Diffstat (limited to 'common')
-rw-r--r--common/DSUtilLite/CueSheet.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/common/DSUtilLite/CueSheet.cpp b/common/DSUtilLite/CueSheet.cpp
index efcc69d4..a249093d 100644
--- a/common/DSUtilLite/CueSheet.cpp
+++ b/common/DSUtilLite/CueSheet.cpp
@@ -66,6 +66,8 @@ static string GetCueParam(string line, bool firstWord = false)
idx = line.find_first_of(delims, idx);
// Find beginning of param
idx = line.find_first_not_of(delims, idx);
+ if (idx == string::npos)
+ return string();
string param = line.substr(idx);
// trim spaces off the end
param = param.substr(0, param.find_last_not_of(delims) + 1);
@@ -73,7 +75,9 @@ static string GetCueParam(string line, bool firstWord = false)
str_replace(param, "\\\"", "\"");
if (firstWord) {
- param = param.substr(0, param.find_first_of(delims));
+ idx = param.find_first_of(delims);
+ if (idx != string::npos)
+ param = param.substr(0, idx);
}
return param;
}