[PATCH] relay: Avoid reading stack memory on unprotected side of stack pointer

Alexandre Julliard julliard at winehq.org
Tue Jul 29 03:18:09 CDT 2008


John Reiser <jreiser at BitWagon.com> writes:

> +    output( "\tmovl %d(%%ecx),%%edx; movl %%edx,%%es:0*4(%%eax)\n", CONTEXTOFFSET(Eax) );
> +    output( "\tmovl %d(%%ecx),%%edx; movl %%edx,%%es:1*4(%%eax)\n", CONTEXTOFFSET(Ecx) );
> +    output( "\tmovl %d(%%ecx),%%edx; movl %%edx,%%es:2*4(%%eax)\n", CONTEXTOFFSET(SegDs) );
> +    output( "\tmovl %d(%%ecx),%%edx; movl %%edx,%%es:3*4(%%eax)\n", CONTEXTOFFSET(Eip) );
> +    output( "\tmovl %d(%%ecx),%%edx; movl %%edx,%%es:4*4(%%eax)\n", CONTEXTOFFSET(SegCs) );
> +    output( "\tmovl %d(%%ecx),%%edx; movl %%edx,%%es:5*4(%%eax)\n", CONTEXTOFFSET(EFlags) );

This won't work if the stack is 16-bit, you'd need to truncate the
address to 16-bit too.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list