d3dxof: Increase MAX_SUBOBJECTS and do the corresponding checks at the right place.

oldstable
Christian Costa 2010-03-23 08:32:20 +01:00 committed by Alexandre Julliard
parent 61cb53e24d
commit f2fe2f7e84
3 changed files with 15 additions and 8 deletions

View File

@ -1104,13 +1104,6 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
goto error;
}
if (This->buf.pxo->nb_subobjects > MAX_SUBOBJECTS)
{
FIXME("Too many subobjects %d\n", This->buf.pxo->nb_subobjects);
hr = DXFILEERR_BADALLOC;
goto error;
}
object->pstrings = pstrings;
object->pobj = This->buf.pxo;
object->cur_enum_object = 0;

View File

@ -39,7 +39,7 @@
#define MAX_CHILDS 100
#define MAX_TEMPLATES 200
#define MAX_OBJECTS 500
#define MAX_SUBOBJECTS 500
#define MAX_SUBOBJECTS 2000
#define MAX_STRINGS_BUFFER 10000
typedef struct {

View File

@ -1212,6 +1212,13 @@ _exit:
ERR("Reference to unknown object %s\n", (char*)buf->value);
return FALSE;
}
if (buf->pxo->root->nb_subobjects >= MAX_SUBOBJECTS)
{
FIXME("Too many sub-objects\n");
return FALSE;
}
buf->pxo->childs[buf->pxo->nb_childs] = &buf->pxo_tab[buf->pxo->root->nb_subobjects++];
buf->pxo->childs[buf->pxo->nb_childs]->ptarget = &(buf->pxo_globals[i])[j];
buf->pxo->nb_childs++;
@ -1219,6 +1226,13 @@ _exit:
else if (check_TOKEN(buf) == TOKEN_NAME)
{
xobject* pxo = buf->pxo;
if (buf->pxo->root->nb_subobjects >= MAX_SUBOBJECTS)
{
FIXME("Too many sub-objects\n");
return FALSE;
}
buf->pxo = buf->pxo->childs[buf->pxo->nb_childs] = &buf->pxo_tab[buf->pxo->root->nb_subobjects++];
TRACE("Enter optional %s\n", (char*)buf->value);