obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

libobs-opengl: Fix incompatible pointer type error for 32-bit arches

Open Conan-Kudo opened this issue 1 year ago • 5 comments

Description

Fix a small pointer type error in libobs-opengl

Motivation and Context

It fixes a build for the library on 32-bit architectures.

How Has This Been Tested?

OBS Studio packages in Fedora has been shipping this since Fedora 40.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

Conan-Kudo avatar Oct 05 '24 15:10 Conan-Kudo

I'm quiet sure that 32 bit support was dropped since the complete switch to Qt6.

tytan652 avatar Oct 05 '24 15:10 tytan652

Our api expects a size_t pointer so callers will be sending in pointers to size_t. You will need to copy the size_t into a correctly sized variable first for this to be correct.

kkartaltepe avatar Oct 05 '24 15:10 kkartaltepe

Is there any way to exclude 32bit builds? We generally just don't support 32bit right now. Because this cast is technically erroneous on 32bit and will cast a 32bit integer (size_t on 32bit) to 64bit (EGLuint64KHR which presumably is 64bit even on 32bit)

Lain-B avatar Oct 05 '24 23:10 Lain-B

Honestly, the only reason I care is because of the vkcapture plugin... It needs a 32-bit libobs because it needs a 32-bit build for 32-bit games. ☹️

Conan-Kudo avatar Oct 06 '24 00:10 Conan-Kudo

beside if 32-bit architecture is supported or not, casting a 32-bit integer pointer to a 64-bit integer would result in a buffer overrun. You should have a 64-bit integer local variable and pass the pointer of it. Then, cast the value of the variable to n_modifiers.

norihiro avatar Oct 06 '24 07:10 norihiro