Fix stage being written past the limit (#716)

This commit is contained in:
smallmodel 2025-04-26 16:39:25 +02:00 committed by GitHub
parent c1efc0e066
commit f2a6278daa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -3135,7 +3135,13 @@ static shader_t *FinishShader( void ) {
// set appropriate stage information
//
stage = 0;
for (shaderStage_t* pStage = &unfoggedStages[0]; pStage->active; pStage++, stage++) {
for ( stage = 0; stage < MAX_SHADER_STAGES; stage++ ) {
shaderStage_t *pStage = &unfoggedStages[stage];
if ( !pStage->active ) {
break;
}
// check for a missing texture
if ( !pStage->bundle[0].image[0] ) {
ri.Printf( PRINT_WARNING, "Shader %s has a stage with no image\n", shader.name );