[Scummvm-git-logs] scummvm master -> c779adb2b1cb1f995ce0fe5faa68ab6e50136efb
sluicebox
noreply at scummvm.org
Thu Oct 17 19:28:23 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
20878e1503 SCI: Fix `getSoundResourceId` validation
c779adb2b1 SCI: Clip kStrCmp result before casting
Commit: 20878e1503ee953fdf0494e0714171e3887b0652
https://github.com/scummvm/scummvm/commit/20878e1503ee953fdf0494e0714171e3887b0652
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-17T13:27:13-06:00
Commit Message:
SCI: Fix `getSoundResourceId` validation
CID 1551903
Changed paths:
engines/sci/sound/soundcmd.cpp
diff --git a/engines/sci/sound/soundcmd.cpp b/engines/sci/sound/soundcmd.cpp
index d2639d0bad5..d40760787c0 100644
--- a/engines/sci/sound/soundcmd.cpp
+++ b/engines/sci/sound/soundcmd.cpp
@@ -69,7 +69,12 @@ reg_t SoundCommandParser::kDoSoundInit(EngineState *s, int argc, reg_t *argv) {
}
int SoundCommandParser::getSoundResourceId(reg_t obj) {
- int resourceId = obj.getSegment() ? (int)readSelectorValue(_segMan, obj, SELECTOR(number)) : -1;
+ if (obj.getSegment() == 0) {
+ return -1;
+ }
+
+ uint16 resourceId = readSelectorValue(_segMan, obj, SELECTOR(number));
+
// Modify the resourceId for the Windows versions that have an alternate MIDI soundtrack, like SSCI did.
if (g_sci->_features->useAltWinGMSound()) {
// Check if the alternate MIDI song actually exists...
Commit: c779adb2b1cb1f995ce0fe5faa68ab6e50136efb
https://github.com/scummvm/scummvm/commit/c779adb2b1cb1f995ce0fe5faa68ab6e50136efb
Author: sluicebox (22204938+sluicebox at users.noreply.github.com)
Date: 2024-10-17T13:27:13-06:00
Commit Message:
SCI: Clip kStrCmp result before casting
CID 1003896
CID 1003897
Changed paths:
engines/sci/engine/kstring.cpp
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index 9171f226ad9..3e4ec5ed401 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -61,10 +61,13 @@ reg_t kStrCmp(EngineState *s, int argc, reg_t *argv) {
Common::String s1 = s->_segMan->getString(argv[0]);
Common::String s2 = s->_segMan->getString(argv[1]);
- if (argc > 2)
- return make_reg(0, strncmp(s1.c_str(), s2.c_str(), argv[2].toUint16()));
- else
- return make_reg(0, strcmp(s1.c_str(), s2.c_str()));
+ int result;
+ if (argc > 2) {
+ result = strncmp(s1.c_str(), s2.c_str(), argv[2].toUint16());
+ } else {
+ result = strcmp(s1.c_str(), s2.c_str());
+ }
+ return make_reg(0, CLIP<int>(result, -32768, 32767));
}
More information about the Scummvm-git-logs
mailing list