[Scummvm-git-logs] scummvm master -> 5e075ffefe86ffe7b3ab880359a1eb85b507a312

Strangerke noreply at scummvm.org
Wed Jan 15 22:30:09 UTC 2025


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:
5e075ffefe GOT: Fix several PVS-Studio issues (V547, V522, V768, V557) in script


Commit: 5e075ffefe86ffe7b3ab880359a1eb85b507a312
    https://github.com/scummvm/scummvm/commit/5e075ffefe86ffe7b3ab880359a1eb85b507a312
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2025-01-15T23:29:32+01:00

Commit Message:
GOT: Fix several PVS-Studio issues (V547, V522, V768, V557) in script

Changed paths:
    engines/got/game/script.cpp


diff --git a/engines/got/game/script.cpp b/engines/got/game/script.cpp
index f5a56d57b26..e0daf2179fc 100644
--- a/engines/got/game/script.cpp
+++ b/engines/got/game/script.cpp
@@ -140,7 +140,7 @@ void Scripts::runScript(bool firstTime) {
 }
 
 void Scripts::scriptLoop() {
-	while (!_paused) {
+	while (_paused == SCRIPT_READY) {
 		if (_G(cheat) && _G(key_flag[_B]))
 			break;
 
@@ -167,7 +167,7 @@ void Scripts::scriptLoop() {
 		}
 	}
 
-	if (!_paused)
+	if (_paused == SCRIPT_READY)
 		script_exit();
 }
 
@@ -286,8 +286,7 @@ nextstr:
 	return 0;
 
 strdone:
-	if (strlen(varstr) > 255)
-		return -1;
+
 	Common::strcpy_s(_tempS, (char *)varstr);
 	return 1;
 }
@@ -468,6 +467,9 @@ int Scripts::get_internal_variable() {
 
 int Scripts::get_line(char *src, char *dst) {
 	int cnt = 0;
+	if (!src)
+		return cnt;
+	
 	while (*src != 13) {
 		if (*src != 10) {
 			*dst = *src;
@@ -1077,6 +1079,10 @@ int Scripts::cmd_exec() {
 	if (_lValue < 1 || _lValue > 10)
 		return 6;
 
+	if (_lValue > 5) {
+		error("cmd_exec - unhandled lValue %d", _lValue);
+	}
+	
 	(this->*scr_func[_lValue - 1])();
 	return 0;
 }




More information about the Scummvm-git-logs mailing list