Skip to content
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

Overflow exception is thrown by Transliterate method for certain characters #159

Open
santoshsg1308 opened this issue Feb 11, 2022 · 1 comment
Labels

Comments

@santoshsg1308
Copy link

santoshsg1308 commented Feb 11, 2022

We are getting an Overflow exception while passing certain characters for conversion to Translieterate method. for eg: if we pass ﷺ as input below

using (var transliteratorLatn = Icu.Transliterator.CreateInstance("Any-Latn"))
{
    return transliteratorLatn.Transliterate(input);
}

If we increase the textMultiplier size to 20 instead of default 3 . i.e. if we do this
transliteratorLatn.Transliterate(input, 20);

then the it works. However we can't be always sure what that second parameter would be ?
Can you please help in resolving the issue?
Also would it have any performance impact in terms of memory consumption increasing the value of textMultiplier as we are upping the buffer value thats gonna hold the converted string?

Below is the exception stack trace
image

@dzendras
Copy link

dzendras commented Nov 8, 2022

Worth mentioning that each occurrence of this error causes a memory leak.

ExceptionFromErrorCode.ThrowIfError(status); //exception thrown here

var result = Marshal.PtrToStringUni(textPtr, textLength);
Marshal.FreeHGlobal(textPtr); //this memory will never be freed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants