Skip to content

Commit

Permalink
Merge pull request scp-fs2open#6368 from Baezon/tmap-25-verts-error
Browse files Browse the repository at this point in the history
Have TMAP chunks report >25 verts polygon error as well
  • Loading branch information
TRBlount authored Sep 29, 2024
2 parents 04f5c2f + 6c1bb9a commit da9ae0d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions code/model/modelcollide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,17 @@ void model_collide_parse_bsp_tmappoly(bsp_collision_leaf *leaf, SCP_vector<model

nv = uw(p + TMAP_NVERTS);

if ( nv > TMAP_MAX_VERTS ) {
Int3();
if (nv > TMAP_MAX_VERTS) {
Error(LOCATION, "Model contains TMAP chunk with more than %d vertices!", TMAP_MAX_VERTS);
return;
}

int tmap_num = w(p + TMAP_TEXNUM);

Assert(tmap_num >= 0 && tmap_num < MAX_MODEL_TEXTURES);
if (tmap_num < 0 || tmap_num >= MAX_MODEL_TEXTURES) {
Error(LOCATION, "Model contains TMAP2 chunk with invalid texture id (%d)!", tmap_num);
return;
}

auto verts = reinterpret_cast<model_tmap_vert_old*>(&p[TMAP_VERTS]);

Expand Down

0 comments on commit da9ae0d

Please sign in to comment.