obsproject / obsproject/obs-studio

Crashes when glGetString returns nullptr

Open
#7,481 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/dependency platform/other
Dominant language
C
Stars
76.4k
Forks
10.2k
Avg merge
4d 23h
Merged PRs (30d)
12

Description

Operating System Info

Other

Other OS

FreeBSD

OBS Studio Version

28.0.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

n/a

OBS Studio Crash Log URL

No response

Expected Behavior

n/a

Current Behavior

obs-studio crashes in deps/glad/src/glad.c:

7053│ static void find_coreGL(void) {
7054│         const char *v = (const char *)glGetString(GL_VERSION);
7055├───────> int major = v[0] - '0';
7056│         int minor = v[2] - '0';

The documentation says that this function can return 0.

obs-studio should report the error properly instead of crashing.

Steps to Reproduce

n/a

Anything else we should know?

There is no error, glGetString returned nullptr probably because there are no extensions available.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in deps/glad/src/glad.c at find_coreGL and inspect how glGetString(GL_VERSION) is used when it returns nullptr. Confirm the null-return path on FreeBSD and ensure OBS reports the graphics initialization error instead of dereferencing the result; the issue does not name a test to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
computer-graphics
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.