-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[bug report] libdeepspeech android JNI crash in utf-8 String convert with zh-cn model. #3802
Comments
bug fix recommendYou cannot use NewStringUTF for this, you will have to manually decode from UTF-8. Cribbing from, we will do the equivalent of
|
bugfix log1:The above Stack Overflow might be misleading. The potential cause of this bug could be that the C++ JNI interface, autogenerated by SWIG, does not support incomplete UTF strings generated by the module during type conversion. |
bug fixed!here is my solution:As I mentioned above, the bug is due to the SWIG auto-generated JNI translation layer, which crashes when dealing with incomplete UTF-8 encoding (Chinese characters are 3 bytes). I have fixed this issue by using an inline hook to modify the char* returned by the DS_IntermediateDecode method, truncating the incomplete characters at the end. proxy_DS_IntermediateDecode's code :
proxy_DS_FreeString's code:
decleard field:
|
The text was updated successfully, but these errors were encountered: