driver crash if VAO is bound after EBO

Seems like this is a long-standing issue: https://www.nvidia.com/en-us/geforce/forums/discover/110603/gldrawelements-crash-in-nvoglv64-dll-260-99/

glGenBuffers(1, &ebo);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, ..., ..., GL_STATIC_DRAW);
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, nullptr);

Exception thrown at 0x0000000066C68EC0 (nvoglv64.dll) in test.exe: 0xC0000005: Access violation reading location 0x0000000000000000:
nvoglv64.dll!0000000066c68ec0() Unknown
nvoglv64.dll!00000000663ca42c() Unknown

glDrawElements(unsigned int arg0=4, int arg1=3, unsigned int arg2=5125, const void * arg3=0x0000000000000000)

Moving the VAO init to the beginning avoids the crash. The same code works on the iGPU IIRC.
Windows 10.0.18362 Driver v436.15
GTX 1060

Note that it crashes in a different place in a separate thread if the number of elements is larger.

Hi, newbie here, with no experience in OpenGL or NVidia (or anything). That said, looking at the spec for glDrawElements, it appears that the arg3, which is currently nullptr, cannot be nullptr (== 0). It has to point to the beginning of the indices that you intend to render.

My guess for a fix would be something like:

glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &vao);

If the compiler complains about that, try:

glDrawElements(GL_TRIANGLES, 3, GL_UNSIGNED_INT, &vao[0]);

If a VAO is bound that parameter becomes an offset.