From: José Fonseca Date: Tue, 12 Apr 2011 18:04:38 +0000 (+0100) Subject: Prevent buffer overflow when dumping depth buffers with odd widths due to unpack... X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=7691c22fea21a1d8a4fbdcbd0d1fbf2324604e6c;p=apitrace Prevent buffer overflow when dumping depth buffers with odd widths due to unpack alignment. --- diff --git a/glstate.py b/glstate.py index 8911c65..6c6f259 100644 --- a/glstate.py +++ b/glstate.py @@ -3116,7 +3116,13 @@ writeDrawBufferImage(JSONWriter &json, GLenum format) glGetIntegerv(GL_DRAW_BUFFER, &drawbuffer); glGetIntegerv(GL_READ_BUFFER, &readbuffer); glReadBuffer(drawbuffer); + + glPushClientAttrib(GL_CLIENT_PIXEL_STORE_BIT); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + glReadPixels(0, 0, width, height, format, GL_UNSIGNED_BYTE, pixels); + + glPopClientAttrib(); glReadBuffer(readbuffer); json.beginMember("__data__");