Fix crashes on malformed TTS input - #5
thomasbuilds wants to merge 4 commits into
Conversation
|
The resource leaks should be fixed now. |
|
@RankoR thanks for the suggestions but I've seen @thestinger merged the commit you were reviewing. |
|
@thomasbuilds It would still be good to change those things, I just wanted to do a SpeechServices v2 release right away to get the fixes out prior to our next OS release. |
|
@thomasbuilds we need to decide what to do with the very-large-numbers issue. I will return with the decision a bit later |
|
Seems like the real limit here isn't That gives two broken ranges: [10^18, Long.MAX] already comes out as silent dollars even though it fits in So fix would be to spell each part from its original digit string instead of round-tripping through |
Locale.Builder setters throw IllformedLocaleException on ill-formed input. GetSampleTextActivity is exported and passes unvalidated extras through, so catch per-field and skip instead of crashing.
SpeechServicesTheme and Typography are never referenced; no Compose UI exists in the app.
Extract link-target feature parsing into parseFeatureValue() and whitespace tokenization into an addNonEmptyWords() helper backed by a single compiled regex. Behavior-preserving. Co-authored-by: Artem Smirnov <artem@smirnov.page>
numToWords only spells values below 10^18. Beyond that ICU returns grouped digits, or "infinite" once the string overflows Double, and extendNum voices neither. The old code therefore dropped amounts in [10^18, Long.MAX] and read amounts above Long.MAX as "zero dollars". Spell each part from its original digit string, reading the digits one by one when the amount overflows Long or numToWords returns no letters.
|
Removed the ktlintCheck fix commit since it got fixed already. |
Malformed locale (
LocaleConversion)Locale.Buildersetters throwIllformedLocaleExceptionon ill-formed input;GetSampleTextActivityforwards unvalidated intent extras, solanguage="x"crashed the process. Each setter is now guarded.Cleanup
Removed unused
SpeechServicesTheme/Typography(no Compose UI).compileDebugKotlinpasses with no new detekt/ktlint findings.other commits stem from conversation below