Skip to content

Log safty #23

Description

@DrYaling
void Log(const char* s, int32 len)
{
    // TODO: Can we get rid of that allocation?
    FString LogString = FString(len, UTF8_TO_TCHAR(s));
    UE_LOG(LogTemp, Warning, TEXT("%s"), *LogString);
}

I'm not sure whether UTF8_TO_TCHAR(s) will lead to undefined behavior. This MACRO will call utf8 conversion of option ENullTerminatedString::Yes, but rust native string end with no \0
Maybe use

 (TCHAR*)FUTF8ToTCHAR((const ANSICHAR*)str, (int32)len).Get()

should be safer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions