Commit 876ed3f9 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

0001-fix-crash-when-inquiring-tile-information-about-an-u.patch

parent 9e6bd2ac
......@@ -306,8 +306,15 @@ int cdiFallbackIterator_inqTile(CdiIterator *super, int *outTileIndex, int *outT
#endif
int error = CDI_NOERR;
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "tileIndex", outTileIndex)) error = CDI_EINVAL;
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "tileAttribute", outTileAttribute)) error = CDI_EINVAL;
if(me->subtypeId == CDI_UNDEFID) //must not call subtypeInqAttribute() with an invalid subtype ID, because it would abort the program instead of returning an error
{
error = CDI_EINVAL;
}
else
{
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "tileIndex", outTileIndex)) error = CDI_EINVAL;
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "tileAttribute", outTileAttribute)) error = CDI_EINVAL;
}
if(error) *outTileIndex = *outTileAttribute = -1; //Guarantee defined values in case of an error.
return error;
}
......@@ -325,8 +332,15 @@ int cdiFallbackIterator_inqTileCount(CdiIterator *super, int *outTileCount, int
#endif
int error = CDI_NOERR;
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "numberOfTiles", outTileCount)) error = CDI_EINVAL;
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "numberOfTileAttributes", outTileAttributeCount)) error = CDI_EINVAL;
if(me->subtypeId == CDI_UNDEFID) //must not call subtypeInqAttribute() with an invalid subtype ID, because it would abort the program instead of returning an error
{
error = CDI_EINVAL;
}
else
{
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "numberOfTiles", outTileCount)) error = CDI_EINVAL;
if(subtypeInqAttribute(me->subtypeId, me->curSubtype, "numberOfTileAttributes", outTileAttributeCount)) error = CDI_EINVAL;
}
if(error) *outTileCount = *outTileAttributeCount = -1; //Guarantee defined values in case of an error.
return CDI_NOERR;
}
......
Supports Markdown
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