Skip to content

[Improvement] Prevent infinite loop when TTF_RenderText_*_Wrapped() is called with a text that contains '\0'Β #572

@uap-universe

Description

@uap-universe

For example when someone accidentally passes a text + length and the length includes the zero-terminator, the call to any TTF_RenderText_*_Wrapped variant blocks indefinitely (probably due to an infinite loop somewhere in the implementation).

While this might be considered invalid input and well outside of the allowed values for this function, it cannot hurt to either sanitize the input or at least do something that does not result in an infinite loop.

The non-Wrapped variants of the functions, for example, also seem to tolerate this. Only the wrapped variants catapult themselves in said infinite loop.

When I see it correctly, the behavior of the non-wrapped variants is to simply skip the \0 character in the rendering.
I propose to implement the same behavior for the wrapped variants.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions