Gene Cumm
2009-Mar-17 16:12 UTC
[syslinux] [PATCH 1/1] CORE/writedec: Fix overflow and redeclaration
From: Gene Cumm <gene.cumm at gmail.com> CORE/writedec: Fix overflow and redeclaration; If EDX is greater than or equal to 10, div can cause an overflow. Comment out declaration of writechr. Signed-off-by: Gene Cumm <gene.cumm at gmail.com> --- Against current head. hpa: If there's a preferred way to do what this function provides, let me know. Was the writechr in there on purpose to prevent the use of this function? diff --git a/core/writedec.inc b/core/writedec.inc index 10bf7ba..6101aeb 100644 --- a/core/writedec.inc +++ b/core/writedec.inc @@ -37,7 +37,8 @@ writedec_common: xor cx,cx ; Number of digits .cloop: - div ebx + mov edx,0 ; Zero out high part + div ebx ; unsigned divide edx:eax/ebx inc cx push dx and eax,eax @@ -53,5 +54,5 @@ writedec_common: popad ret -writechr: - ret +; writechr: +; ret
H. Peter Anvin
2009-Mar-17 18:03 UTC
[syslinux] [PATCH 1/1] CORE/writedec: Fix overflow and redeclaration
Gene Cumm wrote:> From: Gene Cumm <gene.cumm at gmail.com> > > CORE/writedec: Fix overflow and redeclaration; If EDX is greater than > or equal to 10, div can cause an overflow. Comment out declaration of > writechr. > > Signed-off-by: Gene Cumm <gene.cumm at gmail.com> > > --- > > Against current head. > > hpa: If there's a preferred way to do what this function provides, let > me know. Was the writechr in there on purpose to prevent the use of > this function? >No, it was just never actually tested since there was no user for it. -hpa