[Scummvm-cvs-logs] scummvm master -> c8acaff52146e6b88cd82c344252c14faf985ba9
dreammaster
dreammaster at scummvm.org
Thu Dec 10 03:44:40 CET 2015
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c8acaff521 SHERLOCK: Add validation for journal entry values
Commit: c8acaff52146e6b88cd82c344252c14faf985ba9
https://github.com/scummvm/scummvm/commit/c8acaff52146e6b88cd82c344252c14faf985ba9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-12-09T21:44:08-05:00
Commit Message:
SHERLOCK: Add validation for journal entry values
Changed paths:
engines/sherlock/journal.cpp
diff --git a/engines/sherlock/journal.cpp b/engines/sherlock/journal.cpp
index e443b6f..c4aaa07 100644
--- a/engines/sherlock/journal.cpp
+++ b/engines/sherlock/journal.cpp
@@ -715,6 +715,15 @@ void Journal::record(int converseNum, int statementNum, bool replyOnly) {
return;
}
+ // Do a bit of validation here
+ assert(converseNum >= 0 && converseNum < (int)_directory.size());
+ const Common::String &dirFilename = _directory[converseNum];
+ Common::String locStr(dirFilename.c_str() + 4, dirFilename.c_str() + 6);
+ int newLocation = atoi(locStr.c_str());
+ assert(newLocation >= 1 && newLocation <= (int)_locations.size());
+ assert(!_locations[newLocation - 1].empty());
+ assert(statementNum >= 0 && statementNum < (int)_vm->_talk->_statements.size());
+
// Record the entry into the list
_journal.push_back(JournalEntry(converseNum, statementNum, replyOnly));
_index = _journal.size() - 1;
@@ -726,7 +735,7 @@ void Journal::record(int converseNum, int statementNum, bool replyOnly) {
_index = saveIndex;
_sub = saveSub;
- // If new lines were added to the ournal, update the total number of lines
+ // If new lines were added to the journal, update the total number of lines
// the journal continues
if (!_lines.empty()) {
_maxPage += _lines.size();
More information about the Scummvm-git-logs
mailing list