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

tag2015 noreply at scummvm.org
Fri Aug 25 14:58:21 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:
2a255da048 AGS: Engine: Fix possible index out of bounds in SetBlender
b1279dcbd1 AGS: Fix possible index out of bounds in PalRender plugin


Commit: 2a255da048a29b28ffb819d142fc742e6158d5ff
    https://github.com/scummvm/scummvm/commit/2a255da048a29b28ffb819d142fc742e6158d5ff
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-08-25T16:41:57+02:00

Commit Message:
AGS: Engine: Fix possible index out of bounds in SetBlender

>From upstream 0f8e385d23f419e2faed7465d871c0260eda1a1c
Originally reported by mjunix at 74037c7

Changed paths:
    engines/ags/engine/gfx/gfx_util.cpp


diff --git a/engines/ags/engine/gfx/gfx_util.cpp b/engines/ags/engine/gfx/gfx_util.cpp
index 4772a6ef19c..b29c5265bc5 100644
--- a/engines/ags/engine/gfx/gfx_util.cpp
+++ b/engines/ags/engine/gfx/gfx_util.cpp
@@ -65,7 +65,7 @@ static const BlendModeSetter BlendModeSets[kNumBlendModes] = {
 };
 
 bool SetBlender(BlendMode blend_mode, bool dst_has_alpha, bool src_has_alpha, int blend_alpha) {
-	if (blend_mode < 0 || blend_mode > kNumBlendModes)
+	if (blend_mode < 0 || blend_mode >= kNumBlendModes)
 		return false;
 	const BlendModeSetter &set = BlendModeSets[blend_mode];
 	BlenderMode blender;


Commit: b1279dcbd18fcdc28e95ffbfbd1d0cfdadf5d086
    https://github.com/scummvm/scummvm/commit/b1279dcbd18fcdc28e95ffbfbd1d0cfdadf5d086
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-08-25T16:47:21+02:00

Commit Message:
AGS: Fix possible index out of bounds in PalRender plugin

>From upstream 3e25fc6a550b471f472af80ac87966f8998d7fc7
Originally reported by mjunix at 8b8a597

Changed paths:
    engines/ags/plugins/ags_pal_render/raycast.cpp


diff --git a/engines/ags/plugins/ags_pal_render/raycast.cpp b/engines/ags/plugins/ags_pal_render/raycast.cpp
index ff6f4e18860..0dbadb77397 100644
--- a/engines/ags/plugins/ags_pal_render/raycast.cpp
+++ b/engines/ags/plugins/ags_pal_render/raycast.cpp
@@ -632,33 +632,33 @@ void AGSPalRender::MakeTextures(ScriptMethodParams &params) {
 
 void AGSPalRender::Ray_SetFloorAt(ScriptMethodParams &params) {
 	PARAMS3(int, x, int, y, int, tex);
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT || tex > 511) return;
+	if (x < 0 || x >= MAP_WIDTH || y < 0 || y >= MAP_HEIGHT || tex > 511) return;
 	else floorMap[x][y] = tex;
 }
 
 void AGSPalRender::Ray_SetCeilingAt(ScriptMethodParams &params) {
 	PARAMS3(int, x, int, y, int, tex);
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT || tex > 511) return;
+	if (x < 0 || x >= MAP_WIDTH || y < 0 || y >= MAP_HEIGHT || tex > 511) return;
 	else ceilingMap[x][y] = tex;
 }
 
 void AGSPalRender::Ray_GetCeilingAt(ScriptMethodParams &params) {
 	PARAMS2(int, x, int, y);
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1;
+	if (x < 0 || x >= MAP_WIDTH || y < 0 || y >= MAP_HEIGHT) params._result = -1;
 	else params._result = ceilingMap [x][y];
 }
 
 
 void AGSPalRender::Ray_GetFloorAt(ScriptMethodParams &params) {
 	PARAMS2(int, x, int, y);
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1;
+	if (x < 0 || x >= MAP_WIDTH || y < 0 || y >= MAP_HEIGHT) params._result = -1;
 	else params._result = floorMap [x][y];
 }
 
 
 void AGSPalRender::Ray_GetLightingAt(ScriptMethodParams &params) {
 	PARAMS2(int, x, int, y);
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) params._result = -1;
+	if (x < 0 || x >= MAP_WIDTH || y < 0 || y >= MAP_HEIGHT) params._result = -1;
 	else {
 		int lighting = 0;
 		if (ceilingMap[x][y] == 0) {
@@ -671,7 +671,7 @@ void AGSPalRender::Ray_GetLightingAt(ScriptMethodParams &params) {
 
 void AGSPalRender::Ray_SetLightingAt(ScriptMethodParams &params) {
 	PARAMS3(int, x, int, y, unsigned char, lighting);
-	if (x < 0 || x > MAP_WIDTH || y < 0 || y > MAP_HEIGHT) return;
+	if (x < 0 || x >= MAP_WIDTH || y < 0 || y >= MAP_HEIGHT) return;
 	else {
 		lightMap [x][y] = lighting;
 	}




More information about the Scummvm-git-logs mailing list