glfw3 gamma test crashes on windows

Using GLFW
  • Vittorio Lassini

    gamma.exe built from current master crashes with access violation on Windows 7.
    I think the reason is lack of _glfwAllocGammaRamp() call.

    glfwSetGammaRamp() calls _glfwPlatformGetGammaRamp(monitor, &monitor->originalRamp) in the case when monitor->originalRamp.size == 0, but there is no _glfwAllocGammaRamp() inside win32_gamma.c _glfwPlatformGetGammaRamp() function. So this function tries to memcpy() to "unallocated" destination.

    Actually, there is _glfwAllocGammaRamp() call inside X11 version of _glfwPlatformGetGammaRamp(). I've modified code to do _glfwAllocGammaRamp(ramp, 256) before memcpy's (and removed last line with size assignment because it's already inside allocation func) and now gamma test works fine.

    PS. Sorry for my terrible english.

    Last edit: Vittorio Lassini 2013-06-09
  • Camilla Löwy

    Camilla Löwy - 2013-06-09

    Thank you! This has been fixed.