The CLD2 WASM module has a stack size of only 8KB (TOTAL_STACK=8192), leading to stack overflow crashes when processing long texts.
Error Manifestation:
- Abort when processing 282-character mixed English and Chinese text
- Error message: `RuntimeError: Aborted()`
- Crash location: `detectLanguageWithCLD` calling CLD2
- **Makefile**: Increase TOTAL_STACK from 8192 (8KB) to 65536 (64KB)
- An 8-fold increase is sufficient for language detection of complex texts.
- The WASM module size remains unchanged at 1.1MB.
- Input sanitization: Remove null bytes and control characters
- UTF-8 byte boundary truncation: 512-byte limit
- Enhanced error logging: Record crash context
- API request limit: 10MB JSON parsing limit
- `detectLanguageWithLength` method accepts explicit length
- WebIDL interface definition completed
- Temporarily disabled; using the original interface with input sanitization
fix: detectMultipleLanguages
fix: detectMultipleLanguages