Skip to content

libobs: Add minimum version check for some plugins - #14249

Open
Warchamp7 wants to merge 1 commit into
obsproject:masterfrom
Warchamp7:plugin-manifest-restrict
Open

Warchamp7 wants to merge 1 commit into
obsproject:masterfrom
Warchamp7:plugin-manifest-restrict

Conversation

@Warchamp7

Copy link
Copy Markdown
Member

Description

Adds an additional check when loading third party modules to ensure a specific list of plugins meet a minimum version requirement, specified via their manifest file.

Motivation and Context

These are commonly used plugins which also feature a lot of complex functionality. All of them come up pretty frequently in crash reports.

It is possible if not likely that in many of those cases, they are outdated versions that we place no limitation on.

We want to ensure users are on at least a moderately up to date version of them (at least until we have in-app updating and can restrict plugins on every major update). These plugins all distribute versions that include a manifest now, so we can check the version in there during load.

How Has This Been Tested?

I've loaded the current version of each of these plugins successfully in a RelWithDebInfo build.

I set the minimum version to versions higher than this commit and verified each of them then failed to load.

I also deleted the manifest files for each of these plugins, and verified they failed to load.

Types of changes

  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@Warchamp7 Warchamp7 added this to the OBS Studio 33.2 milestone Nov 22, 2026
@Warchamp7 Warchamp7 added area/ui-ux Anything to do with changes or additions to UI/UX elements. area/libobs labels Nov 22, 2026
Comment thread libobs/obs-module.c Outdated
Comment on lines +487 to +491
uint32_t major = 0;
uint32_t minor = 0;
uint32_t patch = 0;

sscanf(version, "%u.%u.%u", &major, &minor, &patch);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance I see multiple issues with this:

  • The %u conversion specifier produces an unsigned int, which indeed is a 32-bit wide type in C. Thus a version like 512.12.765 will be correctly parsed.
  • But encoding each version token in a 32-bit unsigned integer (as this function does) introduces an invariant, depending on the number of version tokens used.
  • For 3 tokens (as thus function does), one could use 10-bit encoding (maximum token value of 1024).
  • But OBS has been using 8-bit encoding instead, so the maximum token value is 255.
  • Which means that a version like 512.12.765 cannot be correctly encoded, even though it is a valid "semantic version string".

This function thus either has to ensure that each version token stays below 256, change the encoding to 10-bit and ensure that the token stays below 1024, use a struct rather than an encoded 32-bit number (as it should IMO), or use a 64-bit number.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to a struct and moved it and the helper functions to their own file.

Comment thread libobs/obs-module.c Resolved
Comment thread libobs/obs-module.c Outdated

static bool module_is_restricted(obs_module_t *module)
{
for (size_t i = 0; i < sizeof(restricted_modules) / sizeof(restricted_modules[0]); i++) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiler probably optimises this into constants automatically, but for readability it wouldn't hurt to store this length as a size value outside of the loop declaration.

While we're at it, it should also use pre-increment.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@github-project-automation github-project-automation Bot moved this from Ready For Review to Requires Changes in Next Release Tracker (33.2) Nov 23, 2026
@Warchamp7
Warchamp7 force-pushed the plugin-manifest-restrict branch from bd8754e to 5fe4324 Compare December 3, 2026 01:08
These are commonly used plugins which also feature a lot of complex
functionality. We want to ensure users are on at least a moderately up
to date version of them, at least until we have in-app updating and can
restrict plugins entirely by libobs version.
@Warchamp7
Warchamp7 force-pushed the plugin-manifest-restrict branch from 5fe4324 to bf1aff5 Compare December 3, 2026 01:11
@Warchamp7
Warchamp7 requested a review from RytoEX December 3, 2026 01:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libobs area/ui-ux Anything to do with changes or additions to UI/UX elements.

Projects

Status: Requires Changes

Development

Successfully merging this pull request may close these issues.

2 participants