Thommil / tge-gl

OpenGL 3 plugin for TGE runtime
BSD 2-Clause "Simplified" License
5 stars 0 forks source link

GetAttribLocation overflow error #1

Closed danaugrs closed 5 years ago

danaugrs commented 5 years ago

Hey! I started working on targeting WebGL with WASM for G3N and been looking through your awesome code.

I noticed that here the result of getAttribLocation is being cast to uint. However, according to the docs the result could be -1, which, when cast to uint, would cause an overflow error.

PS: Thanks for making this and letting us know! It really motivated me to work on G3N further 😄

Thommil commented 5 years ago

Hi, I missed this one, thanks !

I'm looking for a simple solution, I'll keep you updated.

Thommil commented 5 years ago

I set the Attrib to int32 for all targets assuming no buffer overflow on the MAX value of int32 (which I think should never happen). All APIs have been adapted in tge-gl and tge-g3n according to it.

danaugrs commented 5 years ago

Looks good!