Fix memory corruption in the aiGetExportFormatDescription() API. Clarify Exporter doc.
This commit is contained in:
@@ -61,6 +61,8 @@ ASSIMP_API size_t aiGetExportFormatCount(void)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
ASSIMP_API const aiExportFormatDesc* aiGetExportFormatDescription( size_t pIndex)
|
||||
{
|
||||
// Note: this is valid as the index always pertains to a builtin exporter,
|
||||
// for which the returned structure is guaranteed to be of static storage duration.
|
||||
return Exporter().GetExportFormatDescription(pIndex);
|
||||
}
|
||||
|
||||
|
||||
@@ -436,6 +436,11 @@ const aiExportFormatDesc* Exporter :: GetExportFormatDescription( size_t pIndex
|
||||
if (pIndex >= GetExportFormatCount()) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Return from static storage if the requested index is built-in.
|
||||
if (pIndex < sizeof(gExporters) / sizeof(gExporters[0])) {
|
||||
return &gExporters[pIndex].mDescription;
|
||||
}
|
||||
|
||||
return &pimpl->mExporters[pIndex].mDescription;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user