Reproduction steps:
1. Create a new 3D project
2. Click File > Build Settings… > Select WebGL > Switch Platform
3. Click Edit > Project Settings… > Player > WebGL
4. Under Publishing Settings, set “Compression Format” to “Disabled”
5. Click File > Build Settings… > Build
6. Go to the build folder
7. Open “index.html” in your text editor
8. Find “script.onload = ()….” function location and above it enter “var gameInstance = null;”
9. Find “fullscreenButton.onclick …” function location and after it enter “gameInstance = unityInstance”
10. Save “index.html”, close the text editor
11. Open the Terminal in this directory
12. Run “python3 -m http.server“, and open the localhost link
13. In the WebGL application, open the development console for your browser
14. Enter “gameInstance.SendMessage("test", "test", "#".repeat(2**21))“ and press enter
Expected result: The repeated characters are printed out to the browser console
Actual result: WebGL runtime crashes
Reproducible with: 2021.3.30f1, 2022.3.10f1, 2023.1.14f1, 2023.2.0b10, 2023.3.0a6
Environment tested on: Ubuntu 23.04, Windows 10 Pro 22H2
Note: WebGL crashes due to “RuntimeError: index out of bounds”