Backport ignoring values outside lightgrid to OpenGL1
Fixes possibly of reading memory past end of lightGridData or reading wrong light grid data (wrapping around to next row).
This commit is contained in:
1 parent
1bb2bc370d
commit
9f57fea0ee
2 files changed
+10
-6
No files matched your search
@@ -182,6 +182,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
|
||||
data = gridData;
|
||||
for ( j = 0 ; j < 3 ; j++ ) {
|
||||
if ( i & (1<<j) ) {
|
||||
if ( pos[j] + 1 > tr.world->lightGridBounds[j] - 1 ) {
|
||||
break; // ignore values outside lightgrid
|
||||
}
|
||||
factor *= frac[j];
|
||||
data += gridStep[j];
|
||||
} else {
|
||||
@@ -189,6 +192,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( j != 3 ) {
|
||||
continue;
|
||||
}
|
||||
if ( !(data[0]+data[1]+data[2]) ) {
|
||||
continue; // ignore samples in walls
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user