[Scummvm-git-logs] scummvm master -> 220f230d2f38358acfe075b6eee4356cd45cc429

sev- noreply at scummvm.org
Sun Sep 17 19:12:46 UTC 2023


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:
6632467df7 COMMON: Add missing override keywords
220f230d2f GRAPHICS: MACGUI: Fix out of bounds access when clicking outside of help text


Commit: 6632467df776dfbc8a5b5e560c2402ada806b74f
    https://github.com/scummvm/scummvm/commit/6632467df776dfbc8a5b5e560c2402ada806b74f
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-09-17T21:12:34+02:00

Commit Message:
COMMON: Add missing override keywords

Changed paths:
    common/fs.h


diff --git a/common/fs.h b/common/fs.h
index 8581230e032..7480cd2ac7a 100644
--- a/common/fs.h
+++ b/common/fs.h
@@ -263,7 +263,7 @@ public:
 	 *
 	 * @return Pointer to the stream object, nullptr in case of a failure.
 	 */
-	SeekableReadStream *createReadStream() const;
+	SeekableReadStream *createReadStream() const override;
 
 	/**
 	 * Create a SeekableReadStream instance corresponding to an alternate stream
@@ -273,7 +273,7 @@ public:
 	 *
 	 * @return Pointer to the stream object, nullptr in case of a failure.
 	 */
-	SeekableReadStream *createReadStreamForAltStream(AltStreamType altStreamType) const;
+	SeekableReadStream *createReadStreamForAltStream(AltStreamType altStreamType) const override;
 
 	/**
 	 * Create a WriteStream instance corresponding to the file


Commit: 220f230d2f38358acfe075b6eee4356cd45cc429
    https://github.com/scummvm/scummvm/commit/220f230d2f38358acfe075b6eee4356cd45cc429
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2023-09-17T21:12:34+02:00

Commit Message:
GRAPHICS: MACGUI: Fix out of bounds access when clicking outside of help text

Changed paths:
    graphics/macgui/mactext.cpp


diff --git a/graphics/macgui/mactext.cpp b/graphics/macgui/mactext.cpp
index 3ec6b6241b6..5cac7d4b59b 100644
--- a/graphics/macgui/mactext.cpp
+++ b/graphics/macgui/mactext.cpp
@@ -2247,6 +2247,9 @@ Common::U32String MacText::getMouseLink(int x, int y) {
 	int row, chunk;
 	getRowCol(x, y, nullptr, nullptr, &row, nullptr, &chunk);
 
+	if (chunk < 0)
+		return Common::U32String();
+
 	if (!_textLines[row].picfname.empty())
 		return _textLines[row].pictitle;
 
@@ -2288,6 +2291,7 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col, int
 	nrow = lb;
 
 	nsy = _textLines[nrow].y;
+	int chunk = -1;
 
 	if (_textLines[nrow].chunks.size() > 0) {
 		int alignOffset = getAlignOffset(nrow) + _textLines[nrow].indent + _textLines[nrow].firstLineIndent;;
@@ -2295,8 +2299,7 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col, int
 		int width = 0, pwidth = 0;
 		int mcol = 0, pmcol = 0;
 
-		uint chunk;
-		for (chunk = 0; chunk < _textLines[nrow].chunks.size(); chunk++) {
+		for (chunk = 0; chunk < (int)_textLines[nrow].chunks.size(); chunk++) {
 			pwidth = width;
 			pmcol = mcol;
 			if (!_textLines[nrow].chunks[chunk].text.empty()) {
@@ -2308,8 +2311,8 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col, int
 				break;
 		}
 
-		if (chunk == _textLines[nrow].chunks.size())
-			chunk--;
+		if (chunk >= _textLines[nrow].chunks.size())
+			chunk = _textLines[nrow].chunks.size() - 1;
 
 		if (chunk_)
 			*chunk_ = (int)chunk;
@@ -2339,6 +2342,8 @@ void MacText::getRowCol(int x, int y, int *sx, int *sy, int *row, int *col, int
 		*col = ncol;
 	if (row)
 		*row = nrow;
+	if (chunk_)
+		*chunk_ = (int)chunk;
 }
 
 // If adjacent chunks have same format, then skip the format definition




More information about the Scummvm-git-logs mailing list