[Mesa-dev] [PATCH] swrast: Initialize drawFormat in blit_linear after drawRb is initialized

Anuj Phogat anuj.phogat at gmail.com
Thu Jan 17 06:43:08 PST 2013


This fixes a segfault in blit_linear() function:
https://bugs.freedesktop.org/show_bug.cgi?id=59499

Signed-off-by: Anuj Phogat <anuj.phogat at gmail.com>
---
 src/mesa/swrast/s_blit.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c
index 043b578..b643abf 100644
--- a/src/mesa/swrast/s_blit.c
+++ b/src/mesa/swrast/s_blit.c
@@ -542,8 +542,8 @@ blit_linear(struct gl_context *ctx,
    GLint srcBufferY0 = -1, srcBufferY1 = -1;
    GLvoid *dstBuffer;
 
+   gl_format drawFormat;
    gl_format readFormat = _mesa_get_srgb_format_linear(readRb->Format);
-   gl_format drawFormat = _mesa_get_srgb_format_linear(drawRb->Format);
    GLuint bpp = _mesa_get_format_bytes(readFormat);
 
    GLenum pixelType;
@@ -592,6 +592,7 @@ blit_linear(struct gl_context *ctx,
          continue;
       drawAtt = &drawFb->Attachment[idx];
       drawRb = drawAtt->Renderbuffer;
+      drawFormat = _mesa_get_srgb_format_linear(drawRb->Format);
       /*
        * Map src / dst renderbuffers
        */
-- 
1.7.7.6



More information about the mesa-dev mailing list