mirror of
https://github.com/libretro/scummvm.git
synced 2025-04-03 23:31:57 +00:00
AGS: Fix possible index out of bounds in PalRender plugin
From upstream 3e25fc6a550b471f472af80ac87966f8998d7fc7 Originally reported by mjunix@8b8a597
This commit is contained in:
parent
2a255da048
commit
b1279dcbd1
@ -632,33 +632,33 @@ void AGSPalRender::MakeTextures(ScriptMethodParams ¶ms) {
|
||||
|
||||
void AGSPalRender::Ray_SetFloorAt(ScriptMethodParams ¶ms) {
|
||||
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 ¶ms) {
|
||||
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 ¶ms) {
|
||||
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 ¶ms) {
|
||||
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 ¶ms) {
|
||||
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 ¶ms) {
|
||||
|
||||
void AGSPalRender::Ray_SetLightingAt(ScriptMethodParams ¶ms) {
|
||||
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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user