diff --git a/source/plugin/PluginMetaInformationFactory.cpp b/source/plugin/PluginMetaInformationFactory.cpp index debb8db..ca8ab60 100644 --- a/source/plugin/PluginMetaInformationFactory.cpp +++ b/source/plugin/PluginMetaInformationFactory.cpp @@ -56,6 +56,7 @@ std::optional PluginMetaInformationFactory::loadPlugin(st uint32_t sec_num = reader.sections.size(); + bool hasMetaSection = false; for (uint32_t i = 0; i < sec_num; ++i) { ELFIO::section *psec = reader.sections[i]; @@ -72,6 +73,7 @@ std::optional PluginMetaInformationFactory::loadPlugin(st // Get meta information and check WUPS version: if (psec->get_name() == ".wups.meta") { + hasMetaSection = true; const void *sectionData = psec->get_data(); uint32_t sectionSize = psec->get_size(); @@ -118,6 +120,11 @@ std::optional PluginMetaInformationFactory::loadPlugin(st } } } + if (!hasMetaSection) { + DEBUG_FUNCTION_LINE_ERR("File has no \".wups.meta\" section"); + error = PLUGIN_PARSE_ERROR_NO_PLUGIN; + return {}; + } pluginInfo.setSize(pluginSize); diff --git a/source/plugin/PluginMetaInformationFactory.h b/source/plugin/PluginMetaInformationFactory.h index 6020f86..aa518e9 100644 --- a/source/plugin/PluginMetaInformationFactory.h +++ b/source/plugin/PluginMetaInformationFactory.h @@ -28,6 +28,7 @@ enum PluginParseErrors { PLUGIN_PARSE_ERROR_NONE, PLUGIN_PARSE_ERROR_UNKNOWN, + PLUGIN_PARSE_ERROR_NO_PLUGIN, PLUGIN_PARSE_ERROR_INCOMPATIBLE_VERSION, PLUGIN_PARSE_ERROR_BUFFER_EMPTY, PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED, diff --git a/source/utils/exports.cpp b/source/utils/exports.cpp index 1f95ce6..e0eafb3 100644 --- a/source/utils/exports.cpp +++ b/source/utils/exports.cpp @@ -125,6 +125,7 @@ extern "C" PluginBackendApiErrorType WUPSGetPluginMetaInformationEx(WUPSBackendG case PLUGIN_PARSE_ERROR_BUFFER_EMPTY: case PLUGIN_PARSE_ERROR_ELFIO_PARSE_FAILED: case PLUGIN_PARSE_ERROR_IO_ERROR: + case PLUGIN_PARSE_ERROR_NO_PLUGIN: *errOut = PLUGIN_BACKEND_PLUGIN_PARSE_ERROR_UNKNOWN; break; }