Commit f2fe2f7e authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

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

parent 61cb53e2
...@@ -1104,13 +1104,6 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE ...@@ -1104,13 +1104,6 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE
goto error; 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->pstrings = pstrings;
object->pobj = This->buf.pxo; object->pobj = This->buf.pxo;
object->cur_enum_object = 0; object->cur_enum_object = 0;
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define MAX_CHILDS 100 #define MAX_CHILDS 100
#define MAX_TEMPLATES 200 #define MAX_TEMPLATES 200
#define MAX_OBJECTS 500 #define MAX_OBJECTS 500
#define MAX_SUBOBJECTS 500 #define MAX_SUBOBJECTS 2000
#define MAX_STRINGS_BUFFER 10000 #define MAX_STRINGS_BUFFER 10000
typedef struct { typedef struct {
......
...@@ -1212,6 +1212,13 @@ _exit: ...@@ -1212,6 +1212,13 @@ _exit:
ERR("Reference to unknown object %s\n", (char*)buf->value); ERR("Reference to unknown object %s\n", (char*)buf->value);
return FALSE; 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] = &buf->pxo_tab[buf->pxo->root->nb_subobjects++];
buf->pxo->childs[buf->pxo->nb_childs]->ptarget = &(buf->pxo_globals[i])[j]; buf->pxo->childs[buf->pxo->nb_childs]->ptarget = &(buf->pxo_globals[i])[j];
buf->pxo->nb_childs++; buf->pxo->nb_childs++;
...@@ -1219,6 +1226,13 @@ _exit: ...@@ -1219,6 +1226,13 @@ _exit:
else if (check_TOKEN(buf) == TOKEN_NAME) else if (check_TOKEN(buf) == TOKEN_NAME)
{ {
xobject* pxo = buf->pxo; 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++]; 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); TRACE("Enter optional %s\n", (char*)buf->value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment