swrast: Avoid aliasing violation.
[mesa.git] / src / mesa / swrast / s_masking.c
index c95587b204ce82cf4f8e1865cca23784057e3c54..c10bf1ac2516e030ae66f937fde57865f0011929 100644 (file)
@@ -56,8 +56,8 @@ _swrast_mask_rgba_span(struct gl_context *ctx, struct gl_renderbuffer *rb,
     * Note that we're not using span->array->mask[] here.  We could...
     */
    if (span->array->ChanType == GL_UNSIGNED_BYTE) {
-      /* treat 4xGLubyte as 1xGLuint */
-      const GLuint srcMask = *((GLuint *) ctx->Color.ColorMask[buf]);
+      GLuint srcMask;
+      memcpy(&srcMask, ctx->Color.ColorMask[buf], sizeof(srcMask));
       const GLuint dstMask = ~srcMask;
       const GLuint *dst = (const GLuint *) rbPixels;
       GLuint *src = (GLuint *) span->array->rgba8;