emscripten-core / emscripten

Emscripten: An LLVM-to-WebAssembly Compiler
Other
25.35k stars 3.25k forks source link

Fix a crash in miniTempWebGL*Buffers optimization #22130

Closed kainino0x closed 6 days ago

kainino0x commented 1 week ago

library_webgl.js attempts to use a pool of temp float or int buffers for uniform uploads up to 288 elements, however it would only allocate 288 temp buffers, so 0 through 287 would be fine but 288 would crash (miniTempWebGLFloatBuffers[288] would be undefined).

Confirmed manually that any one of the six "Just at the optimization limit" calls would crash before, and with the fix does not.

Fix for the change in PR #21573