ak1394 / react-native-tts

React Native Text-To-Speech library for Android and iOS
618 stars 156 forks source link

EXC_BAD_ACCESS: TTSCreateDecryptedDataFromEncryptedData #162

Open ninjz opened 3 years ago

ninjz commented 3 years ago

I'm getting this crash occurring recently in dev mode in iOS 14.3 on my iPhone X. Has anyone come across this similar issue?

Stack Trace:

OS Version: iOS 14.3 (18C66)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: BUS_NOOP at 0x000000011a400000
Crashed Thread: 37

Application Specific Information:
appendBytes:length: > appendData: > containsString: > countByEnumeratingWithState:objects:count: > dataUsingEncoding: > JBOs > path >
Attempted to dereference garbage pointer 0x11a400000.

Thread 37 Crashed:
0   TextToSpeech                    0x340a12688         TTSCreateDecryptedDataFromEncryptedData
1   TextToSpeechBundleSupport       0x351d36b88         -[TTSVocalizer loadResource:mimeType:resourceURL:supportsAccurateWordCallbacks:]
2   TextToSpeechBundleSupport       0x351d34188         -[TTSSpeechServerInstance _loadVoiceResource:voiceResource:]
3   TextToSpeechBundleSupport       0x351d33c80         -[TTSSpeechServerInstance _initializeSpeechEngine:]
4   TextToSpeechBundleSupport       0x351d33f00         -[TTSSpeechServerInstance _initializeSpeech:]
5   TextToSpeechBundleSupport       0x351d3149c         -[TTSSpeechServerInstance _processCurrentRequest:]
6   TextToSpeechBundleSupport       0x351d32630         -[TTSSpeechServerInstance _handleSpeechThread]
7   TextToSpeechBundleSupport       0x351d31450         _SpeechThread
8   libsystem_pthread.dylib         0x393d15b38         _pthread_start
ninjz commented 3 years ago

Update: It seems from my sentry logs that this has only started occurring with iOS 14.3.

Also, found this related thread on the Apple Developer forum: https://developer.apple.com/forums/thread/671863

ghsdh3409 commented 3 years ago

After I read the above thread and I am able to fix it by removing willSpeakRangeOfSpeechString on TextToSpeech.m. If your application does not use tts-progress, then you can remove it.

https://github.com/ak1394/react-native-tts/blob/71eb3db7531f4827a3cba61f242b84f6a712e74e/ios/TextToSpeech/TextToSpeech.m#L262-L268

https://developer.apple.com/forums/thread/671863?answerId=658584022#658584022

Gyran commented 3 years ago

A new asset went live today that should resolve this issue, and devices should download it within the next day or so automatically. We will also address the root cause of the crash in a future version of iOS. Those of you seeing spikes in crashes in your apps should see those spikes go away shortly. https://developer.apple.com/forums/thread/671863?answerId=659189022#659189022

That was said last Tuesday (2021-01-26) so hopefully crashes should stop appearing soon. We haven't seen any for a few days now.