[Gmp-commit] /var/hg/gmp: Fix out-of-bounds read for n=1.
mercurial at gmplib.org
mercurial at gmplib.org
Mon Mar 7 00:23:12 CET 2011
details: /var/hg/gmp/rev/ff46de76bb88
changeset: 14005:ff46de76bb88
user: Torbjorn Granlund <tege at gmplib.org>
date: Mon Mar 07 00:23:06 2011 +0100
description:
Fix out-of-bounds read for n=1.
diffstat:
mpn/x86/atom/sse2/sqr_basecase.asm | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diffs (42 lines):
diff -r 29abf9a2bf15 -r ff46de76bb88 mpn/x86/atom/sse2/sqr_basecase.asm
--- a/mpn/x86/atom/sse2/sqr_basecase.asm Mon Mar 07 00:00:06 2011 +0100
+++ b/mpn/x86/atom/sse2/sqr_basecase.asm Mon Mar 07 00:23:06 2011 +0100
@@ -63,6 +63,10 @@
lea -1(n), %eax
neg n
movd (up), %mm7
+
+ test %eax, %eax
+ jz L(one)
+
movd 4(up), %mm0
lea 4(up), up
pmuludq %mm7, %mm0
@@ -114,15 +118,12 @@
jmp L(ol2)
C ================================================================
-L(of0): test n, n
- jz L(one)
- jmp L(xx0)
ALIGN(16)
L(lm0): movd (up), %mm0
pmuludq %mm7, %mm0
psrlq $32, %mm6
lea 16(rp), rp
-L(xx0): paddq %mm0, %mm6
+L(of0): paddq %mm0, %mm6
movd 4(up), %mm0
pmuludq %mm7, %mm0
movd %mm6, (rp)
@@ -603,8 +604,7 @@
pop %edi
ret
-L(one): movd -4(up), %mm0
- pmuludq %mm0, %mm0
- movq %mm0, -4(rp)
+L(one): pmuludq %mm7, %mm7
+ movq %mm7, -4(rp)
jmp L(rtn)
EPILOGUE()
More information about the gmp-commit
mailing list