Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glBufferSubData overflows when size == 0 #16799

Closed
paradust7 opened this issue Apr 24, 2022 · 3 comments · Fixed by #16837
Closed

glBufferSubData overflows when size == 0 #16799

paradust7 opened this issue Apr 24, 2022 · 3 comments · Fixed by #16837

Comments

@paradust7
Copy link

The optimization for WebGL2 is incorrect in the case of size == 0, because WebGL2 interprets size 0 as "the entire array buffer from the offset until the end".

https://github.com/emscripten-core/emscripten/blob/ec0d9c7d352d0fb694c3493f21d8ba8279e57589/src/library_webgl.js#L1803A

Original commit that added this line:
38b559c

Please include the following in your bug report:

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 3.1.8 (3ff7eff)
clang version 15.0.0 (https://github.com/llvm/llvm-project 80ec0ebfdc5692a58e0832125f2c6a991df9d63f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /home/mtuser/emsdk/upstream/bin

@paradust7 paradust7 changed the title glSubBufferData overflows when size == 0 using WebGL2 glSubBufferData overflows when size == 0 Apr 24, 2022
@paradust7 paradust7 changed the title glSubBufferData overflows when size == 0 glBufferSubData overflows when size == 0 Apr 24, 2022
@kripken
Copy link
Member

kripken commented Apr 25, 2022

cc @juj

juj added a commit to juj/emscripten that referenced this issue Apr 28, 2022
…, which would upload the whole WebAssembly heap since WebGL has a different semantics when zero size is passed. Fixes emscripten-core#16799.
@juj
Copy link
Collaborator

juj commented Apr 28, 2022

I recall we had a conversation some time before about this? or even a PR, or something?

Anyhow, authored #16837 which goes through all the different WebGL 1&2 API functions that suffer from this issue.

@juj
Copy link
Collaborator

juj commented Apr 28, 2022

Original commit that added this line: 38b559c

That commit is not related, the issue has existed since the advent of WebGL 2.

juj added a commit that referenced this issue Apr 28, 2022
…, which would upload the whole WebAssembly heap since WebGL has a different semantics when zero size is passed. Fixes #16799. (#16837)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants