Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leak of FILE descriptor and using nullptr in memset #11888

Closed
safocl opened this issue Feb 23, 2025 · 4 comments
Closed

Leak of FILE descriptor and using nullptr in memset #11888

safocl opened this issue Feb 23, 2025 · 4 comments

Comments

@safocl
Copy link

safocl commented Feb 23, 2025

Operating System Info

Other

Other OS

Archlinux

OBS Studio Version

31.0.1

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://0x0.st/8TfN.txt

OBS Studio Crash Log URL

No response

Expected Behavior

Not leak of FILE descriptor and do not using nullptr in memset (defined behavior).

Current Behavior

Leak of FILE descriptor and using nullptr in memset (undefined behavior).

Steps to Reproduce

  1. Compile

Anything else we should know?

memset(data, '\0', file_size);

but malloc can return nullptr:
data = (utf8_char_t*)malloc(1 + file_size);

https://en.cppreference.com/w/c/string/byte/memset

The behavior is undefined if dest is a null pointer.

FILE* file = fopen(path, "r");

FILE is closed in the if closure only:

@Fenrirthviti
Copy link
Member

libcaption is a depedency, please report upstream: https://github.com/szatmary/libcaption

@Fenrirthviti Fenrirthviti closed this as not planned Won't fix, can't repro, duplicate, stale Feb 23, 2025
@safocl
Copy link
Author

safocl commented Feb 23, 2025

maybe this dependency needs to be released?? (the last update is a7666c1 · 7 years ago)

@Fenrirthviti
Copy link
Member

That has definitely been a consideration, yes.

@safocl
Copy link
Author

safocl commented Feb 23, 2025

That has definitely been a consideration, yes.

this dependency is hardcode for this project -- maybe we should fix everything there ourselves?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants