diff options
author | richiesams | 2013-08-17 20:35:57 -0500 |
---|---|---|
committer | richiesams | 2013-08-18 19:52:58 -0500 |
commit | 77219705e6f225c4296b5d5346b2abd8fe2aaade (patch) | |
tree | 660f15782d61538ce75c694acdd5604da336f641 | |
parent | f1d44bdf8cbcf69805713f042b16480227e14d6c (diff) | |
download | scummvm-rg350-77219705e6f225c4296b5d5346b2abd8fe2aaade.tar.gz scummvm-rg350-77219705e6f225c4296b5d5346b2abd8fe2aaade.tar.bz2 scummvm-rg350-77219705e6f225c4296b5d5346b2abd8fe2aaade.zip |
ZVISION: Prevent endless looping due to incorrect file structure
Some of the .scr files don't properly close the last curly brace
-rw-r--r-- | engines/zvision/control.cpp | 6 | ||||
-rw-r--r-- | engines/zvision/scr_file_handling.cpp | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/engines/zvision/control.cpp b/engines/zvision/control.cpp index 02d15fe9d0..eeba9b3214 100644 --- a/engines/zvision/control.cpp +++ b/engines/zvision/control.cpp @@ -44,7 +44,7 @@ void Control::parsePanoramaControl(ZVision *engine, Common::SeekableReadStream & Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("angle*", true)) { float fov; sscanf(line.c_str(), "angle(%f)", &fov); @@ -78,7 +78,7 @@ void Control::parseTiltControl(ZVision *engine, Common::SeekableReadStream &stre Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("angle*", true)) { float fov; sscanf(line.c_str(), "angle(%f)", &fov); @@ -110,7 +110,7 @@ void Control::parsePushToggleControl(uint32 key, ZVision *engine, Common::Seekab Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("*_hotspot*", true)) { uint x; uint y; diff --git a/engines/zvision/scr_file_handling.cpp b/engines/zvision/scr_file_handling.cpp index 5b8af48047..9c99ce184d 100644 --- a/engines/zvision/scr_file_handling.cpp +++ b/engines/zvision/scr_file_handling.cpp @@ -76,7 +76,7 @@ void ScriptManager::parsePuzzle(Puzzle &puzzle, Common::SeekableReadStream &stre Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("criteria {", true)) { Puzzle::Criteria criteria; if (parseCriteria(&criteria, stream)) { @@ -103,7 +103,7 @@ bool ScriptManager::parseCriteria(Puzzle::Criteria *criteria, Common::SeekableRe return false; } - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { // Split the string into tokens using ' ' as a delimiter Common::StringTokenizer tokenizer(line); Common::String token; @@ -147,7 +147,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis trimCommentsAndWhiteSpace(&line); // TODO: Re-order the if-then statements in order of highest occurrence - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.empty()) { line = stream.readLine(); trimCommentsAndWhiteSpace(&line); @@ -284,7 +284,7 @@ uint ScriptManager::parseFlags(Common::SeekableReadStream &stream) const { Common::String line = stream.readLine(); trimCommentsAndWhiteSpace(&line); - while (!line.contains('}')) { + while (!stream.eos() && !line.contains('}')) { if (line.matchString("ONCE_PER_INST", true)) { flags |= Puzzle::ONCE_PER_INST; } else if (line.matchString("DO_ME_NOW", true)) { |