-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
SdfAssetPath fails to validate utf8 encoded character '響' #2560
Comments
Filed as internal issue #USD-8548 |
There is a bug in _ReadUTF8 OpenUSD/pxr/usd/sdf/assetPath.cpp Line 59 in 10b6243
The sign bit is carried at bitwise operations for some UTF-8 char(including "響") and returns OpenUSD/pxr/usd/sdf/assetPath.cpp Line 97 in 10b6243
Adding uchar casting property to bitwise operations should solve the issue. https://gist.github.com/syoyo/42fe2874cc6f86d0f281f1f523cc98ab Also, _ReadUTF8 is vulnerable to corrupted char array input. It'd be better to use simpler & safer utf8 string to utf8 code converter like this(used in the above gitst snippet): https://github.com/lighttransport/japanese-normalizer-cpp/blob/d23b9ec71b74a0609c293e5a72c8ace9ecc4a1a4/jp_normalizer.hh#L178 |
Description of Issue
When I pass string contains utf8 character u8'響', (0xE9, 0x9F, 0xBF), to SdfAssetPath, the validation fails and reports error.
So I think this happens when SdfAssetPath get string contains u8'響' led by only single-byte characters.
I'm not sure other character triggers this issue.
Steps to Reproduce
via usda file
I tried with usdview and usdcat
via tiny c++ code
This code will print:
System Information (OS, Hardware)
Windows 10 22H2 (pro) with VisualStudio 2019
Windows 11 22H2 (ent) with VisualStudio 2022
Package Versions
v23.08
Build Flags
I build usd with plain
build_scripts/build_usd.py path/to/build
.Best,
The text was updated successfully, but these errors were encountered: