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

Potential crash when using unicode characters in filename #11211

Open
Penwy opened this issue Aug 28, 2024 · 1 comment
Open

Potential crash when using unicode characters in filename #11211

Penwy opened this issue Aug 28, 2024 · 1 comment

Comments

@Penwy
Copy link
Contributor

Penwy commented Aug 28, 2024

Operating System Info

Ubuntu 22.04

Other OS

No response

OBS Studio Version

30.2.2

OBS Studio Version (Other)

No response

OBS Studio Log URL

https://obsproject.com/logs/SZyGPxeg4afmKJdo

OBS Studio Crash Log URL

No response

Expected Behavior

Obs should not crash on start recording, no matter what the user decided to put in the filename formatting.

Current Behavior

os_generate_formatted_filename crops the generated filename to 255 bytes, before returning it. However, unicode characters can be more than one byte, as such, this cropping can turn the last character of the filename into an invalid character if the cropping happens in its middle.
This then causes a crash when said filename is attempted to be used.

Steps to Reproduce

  1. Change filename formatting to %CCYY-%MM-%DD %hh-%mm-%ss foo​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​bar (there's 100 zero-width spaces between the foo and the bar, so, copy-paste)
  2. Press "Start Recording"
  3. Notice crash
    ...
    N.B.: the error doesn't appear in the log itself :
terminate called after throwing an instance of 'nlohmann::detail::type_error'
  what():  [json.exception.type_error.316] incomplete UTF-8 string; last byte: 0xE2
Aborted (core dumped)

Anything else we should know?

Honestly, the impact of this is probably rather minimal, it only surfaced because Call of Duty are weirdos and put something like 70 zero-width spaces in their window title for no reason whatsoever.

@Penwy
Copy link
Contributor Author

Penwy commented Aug 28, 2024

Slightly related, and possibly worthy to include in a fix : said 255 bytes crop happens after applying the extension, and as such will often create an extension-less file, which crashes the muxer.

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

1 participant