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

text-freetype2: Fix bug with null characters #10434

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lourencop01
Copy link

@lourencop01 lourencop01 commented Mar 26, 2024

When uploading a file containing null characters only the characters before the first null character would be rendered. Fixed by sanitizing the null characters from the bytes read from the uploaded file.

Description

Sanitize null characters from the bytes read from an uploaded file.

Motivation and Context

This change fixes the issue reported on: obs-studio/issues#7595, where when a user uploaded a file containing null characters, only the characters prior to the first null character would be rendered. With this fix, the correct text from the file is rendered.

How Has This Been Tested?

The changes were tested by uploading a file containing null characters.
The testing environment is macOS Sonoma 14.3.1

Types of changes

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

Checklist:

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

When uploading a file containing null characters only the characters
before the first null character would be rendered. Fixed by sanitizing
the null characters from the bytes read from the uploaded file.
@RytoEX RytoEX added the Bug Fix Non-breaking change which fixes an issue label Mar 26, 2024
@kkartaltepe
Copy link
Collaborator

This seems like it would work, but I'm not sure we are keen on committing a workaround for this issue other than just fixing string handling throughout.

@lourencop01
Copy link
Author

Got it, no worries!

Since you're not looking for either displaying null characters as glyphs or sanitizing them, could you please clarify what the ideal solution would be?

Thank you!

@lourencop01
Copy link
Author

Hey, just following up on this last message to bump it up on your notifications box! :)

@kkartaltepe
Copy link
Collaborator

#7595 (comment) covers this. Specifically we dont need to change null bytes or use any special representation of them to fix the issue, just to manage the length of strings correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Fix Non-breaking change which fixes an issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants