From: havoc Date: Thu, 30 Sep 2010 20:35:12 +0000 (+0000) Subject: don't crash in obj loading if v, vt, or vn are NULL or the indices are X-Git-Tag: xonotic-v0.1.0preview~145 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=aea474662b4a96e3a20a4fef464daea44c1552a7;p=xonotic%2Fdarkplaces.git don't crash in obj loading if v, vt, or vn are NULL or the indices are invalid git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@10508 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=efe66e1a99b2ad1b6aaa2a5c131237b9cb7b4ee4 --- diff --git a/model_brush.c b/model_brush.c index 471eeced..a1cdb180 100644 --- a/model_brush.c +++ b/model_brush.c @@ -7382,9 +7382,12 @@ void Mod_OBJ_Load(dp_model_t *mod, void *buffer, void *bufferend) vcurrent.nextindex = -1; vcurrent.textureindex = textureindex; vcurrent.submodelindex = submodelindex; - VectorCopy(v + 3*index1, vcurrent.v); - Vector2Copy(vt + 2*index2, vcurrent.vt); - VectorCopy(vn + 3*index3, vcurrent.vn); + if (v && index1 >= 0 && index1 < numv) + VectorCopy(v + 3*index1, vcurrent.v); + if (vt && index2 >= 0 && index2 < numvt) + Vector2Copy(vt + 2*index2, vcurrent.vt); + if (vn && index3 >= 0 && index3 < numvn) + VectorCopy(vn + 3*index3, vcurrent.vn); if (numtriangles == 0) { VectorCopy(vcurrent.v, mins);