[GHC] #2144: The OpenGL binding uses withCAStringLen where it should use withCAString

GHC trac at galois.com
Sun Mar 9 14:50:55 EDT 2008


#2144: The OpenGL binding uses withCAStringLen where it should use withCAString
------------------------+---------------------------------------------------
    Reporter:  guest    |       Owner:                   
        Type:  bug      |      Status:  new              
    Priority:  normal   |   Component:  libraries (other)
     Version:  6.8.2    |    Severity:  major            
    Keywords:           |    Testcase:                   
Architecture:  Unknown  |          Os:  Unknown          
------------------------+---------------------------------------------------
 In the module `Graphics.Rendering.OpenGL.GL.Shaders` (and possibly in
 other parts of the OpenGL binding, I didn't check) when passing a string
 to the OpenGL drivers, the library always uses `withCAStringLen` to
 marshal the strings, which does not put the required the zero byte at the
 end of the string. This causes the functions `getAttribLocation`,
 `bindAttribLocation` and `uniformLocation` to fail randomly (it was a real
 pain to localize this bug...). The solution is to use `withCAString` in
 these cases instead (and meantime, as a workaround, to put the zero
 character there manually in the client code).

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2144>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the Glasgow-haskell-bugs mailing list