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
- 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:
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
Anything else we should know?
obs-studio/deps/libcaption/src/utf8.c
Line 207 in 73725c2
but
malloccan returnnullptr:obs-studio/deps/libcaption/src/utf8.c
Line 206 in 73725c2
https://en.cppreference.com/w/c/string/byte/memset
obs-studio/deps/libcaption/src/utf8.c
Line 197 in 73725c2
FILE is closed in the if closure only:
obs-studio/deps/libcaption/src/utf8.c
Line 219 in 73725c2