Commit 7e7630bb authored by Robert Morell's avatar Robert Morell Committed by Alan Coopersmith

glx: Fix mask truncation in __glXGetAnswerBuffer [CVE-2014-8093 6/6]

On a system where sizeof(unsigned) != sizeof(intptr_t), the unary
bitwise not operation will result in a mask that clears all high bits
from temp_buf in the expression:
        temp_buf = (temp_buf + mask) & ~mask;
Signed-off-by: default avatarRobert Morell <>
Reviewed-by: Alan Coopersmith's avatarAlan Coopersmith <>
Signed-off-by: Alan Coopersmith's avatarAlan Coopersmith <>
parent e883c170
......@@ -73,7 +73,7 @@ __glXGetAnswerBuffer(__GLXclientState * cl, size_t required_size,
void *local_buffer, size_t local_size, unsigned alignment)
void *buffer = local_buffer;
const unsigned mask = alignment - 1;
const intptr_t mask = alignment - 1;
if (local_size < required_size) {
size_t worst_case_size;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment