Explorar el Código

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.
Norihiro Kamae hace 3 años
padre
commit
505b76e8a7
Se han modificado 1 ficheros con 8 adiciones y 0 borrados
  1. 8 0
      libobs/obs-module.c

+ 8 - 0
libobs/obs-module.c

@@ -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);