mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-05-11 16:59:43 -04:00
libobs: Reject plugins compiled with newer libobs
Check obs_module_ver and reject if the plugin is built with a newer libobs major/minor version.
This commit is contained in:
committed by
Ryan Foster
parent
ffcc3acd9d
commit
505b76e8a7
@@ -124,6 +124,14 @@ int obs_open_module(obs_module_t **module, const char *path, const char *data_pa
|
||||
if (errorcode != MODULE_SUCCESS)
|
||||
return errorcode;
|
||||
|
||||
/* Reject plugins compiled with a newer libobs. Patch version (lower 16-bit) is ignored. */
|
||||
uint32_t ver = mod.ver ? mod.ver() & 0xFFFF0000 : 0;
|
||||
if (ver > LIBOBS_API_VER) {
|
||||
blog(LOG_WARNING, "Module '%s' compiled with newer libobs %d.%d", path, (ver >> 24) & 0xFF,
|
||||
(ver >> 16) & 0xFF);
|
||||
return MODULE_INCOMPATIBLE_VER;
|
||||
}
|
||||
|
||||
mod.bin_path = bstrdup(path);
|
||||
mod.file = strrchr(mod.bin_path, '/');
|
||||
mod.file = (!mod.file) ? mod.bin_path : (mod.file + 1);
|
||||
|
||||
Reference in New Issue
Block a user