[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE: [Xen-devel] [PATCH] Xen: fix various checks of unsigned integers < 0
> diff -r 3cc0fac4a49e -r 52ce5ef855cf > xen/arch/x86/x86_emulate/x86_emulate.c > --- a/xen/arch/x86/x86_emulate/x86_emulate.c Fri Oct 29 14:57:50 > 2010 +0100 > +++ b/xen/arch/x86/x86_emulate/x86_emulate.c Fri Oct 29 14:57:54 > 2010 +0100 > @@ -2102,7 +2102,7 @@ x86_emulate( > _regs.edx = (uint32_t)(((int32_t)_regs.eax < 0) ? -1 : 0); > break; > case 8: > - _regs.edx = (_regs.eax < 0) ? -1 : 0; > + _regs.edx = ((int64_t)_regs.eax < 0) ? -1 : 0; > break; > } > break; (/me goes and looks up the cwd instruction...) Wow, I wonder how many times this code has executed and returned the wrong (incorrectly sign-extended) value? Talk about a possible silent-but-deadly bug that would be impossible to track down! Nice catch! Future Xen support people thank you! _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |