[Scummvm-git-logs] scummvm master -> aeb1003d5e4278126acc2296788b42272aa98eaa

athrxx noreply at scummvm.org
Thu Nov 23 14:51:01 UTC 2023


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:
aeb1003d5e SCUMM: fix possible invalid access


Commit: aeb1003d5e4278126acc2296788b42272aa98eaa
    https://github.com/scummvm/scummvm/commit/aeb1003d5e4278126acc2296788b42272aa98eaa
Author: athrxx (athrxx at scummvm.org)
Date: 2023-11-23T15:50:18+01:00

Commit Message:
SCUMM: fix possible invalid access

(won't happen, but PVS studio wants this)

Changed paths:
    engines/scumm/string_v7.cpp


diff --git a/engines/scumm/string_v7.cpp b/engines/scumm/string_v7.cpp
index 76b0ef7143f..df5712baa20 100644
--- a/engines/scumm/string_v7.cpp
+++ b/engines/scumm/string_v7.cpp
@@ -310,7 +310,9 @@ void TextRenderer_v7::drawStringWrap(const char *str, byte *buffer, Common::Rect
 				substrWidths[numSubstrings] = curWidth;
 				substrByteLength[numSubstrings] = curPos - substrStart[numSubstrings];
 				numSubstrings++;
-				substrStart[numSubstrings] = curPos + 1;
+				// extra check for PVS-Studio (we won't actually ever get close to SCUMM7_MAX_STRINGS)
+				if (numSubstrings < SCUMM7_MAX_STRINGS)
+					substrStart[numSubstrings] = curPos + 1;
 			}
 			curWidth = 0;
 		}




More information about the Scummvm-git-logs mailing list