aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLittleboy2014-06-11 21:26:40 -0400
committerLittleboy2014-06-16 18:46:27 -0400
commit4f78d1faec9838e5523292b1db39500b24d45059 (patch)
tree25405ae74d1e0a71ecf1e5685f0f7750964656cc
parent771cae50e4e1960fd76311fbb79971b999ec0332 (diff)
downloadscummvm-rg350-4f78d1faec9838e5523292b1db39500b24d45059.tar.gz
scummvm-rg350-4f78d1faec9838e5523292b1db39500b24d45059.tar.bz2
scummvm-rg350-4f78d1faec9838e5523292b1db39500b24d45059.zip
LASTEXPRESS: Add asserts in sound entry serialization and update code. CID 1003259, 1003260
-rw-r--r--engines/lastexpress/sound/entry.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/engines/lastexpress/sound/entry.cpp b/engines/lastexpress/sound/entry.cpp
index 6bf1ebc9de..f2967fd49f 100644
--- a/engines/lastexpress/sound/entry.cpp
+++ b/engines/lastexpress/sound/entry.cpp
@@ -33,7 +33,6 @@
#include "lastexpress/lastexpress.h"
#include "lastexpress/resource.h"
-
namespace LastExpress {
#define SOUNDCACHE_ENTRY_SIZE 92160
@@ -267,6 +266,8 @@ void SoundEntry::update(uint val) {
}
bool SoundEntry::updateSound() {
+ assert(_name2.size() <= 16);
+
bool result;
char sub[16];
@@ -279,6 +280,7 @@ bool SoundEntry::updateSound() {
_status.status &= ~0x8000;
strcpy(sub, _name2.c_str());
+ // FIXME: Rewrite and document expected behavior
int l = strlen(sub) + 1;
if (l - 1 > 4)
sub[l - (1 + 4)] = 0;
@@ -361,6 +363,9 @@ void SoundEntry::showSubtitle(Common::String filename) {
}
void SoundEntry::saveLoadWithSerializer(Common::Serializer &s) {
+ assert(_name1.size() <= 16);
+ assert(_name2.size() <= 16);
+
if (_name2.matchString("NISSND?") && (_status.status & kFlagType7) != kFlag3) {
s.syncAsUint32LE(_status.status);
s.syncAsUint32LE(_type);