mirror of https://github.com/stenzek/duckstation
System: Fix some bugs in GetTitleForPath
The previous implementation had a few issues in certain edge cases: - If the path contained no '/' or '\', then the string_view constructor is called with a count that exceeds the length of the string (effectively `title_end - (char *)0`, which is undefined behavior, at least in C). - If the only '/' was the filesystem root, the last character of the title was truncated, and the '/' remained. For example, "/title.bin" resulted in "/titl". - At least in C, it is undefined behavior to use the the < operator with a null pointer, which is done in std::max if the path did not have both '/' and '\'. The first issue results in a std::bad_alloc exception on my machine.pull/1306/head
parent
fcc6bf0cb7
commit
64c0ca14a3
Loading…
Reference in New Issue