[Libreoffice-commits] core.git: embedserv/source

Tor Lillqvist tml at collabora.com
Tue Sep 3 14:43:07 PDT 2013


 embedserv/source/inprocserv/dllentry.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit a463f74ebf9a2d415f645d4d81377f0207216324
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Sep 4 00:40:46 2013 +0300

    WaE: C4723: potential divide by 0
    
    Fix crack that formats an int into eight hex digits. Why the simple
    sprintf() that originally was used here was not good enough, but had
    to be replaced (in 2009) by broken and hard to understand code I have
    no idea.
    
    Found during link-time code generation (!).
    
    Change-Id: I05b33ca0fcb6a47a846ec2ff294243c5639a5b49

diff --git a/embedserv/source/inprocserv/dllentry.cxx b/embedserv/source/inprocserv/dllentry.cxx
index 3622c96..e642128 100644
--- a/embedserv/source/inprocserv/dllentry.cxx
+++ b/embedserv/source/inprocserv/dllentry.cxx
@@ -53,7 +53,7 @@ namespace {
         int nInd = 0;
         while( nInd < nLen )
         {
-            char nSign = ( nValue / ( 1 << ( ( nLen - nInd ) * 4 ) ) ) % 16;
+            char nSign = ( nValue / ( 1 << ( ( nLen - nInd - 1 ) * 4 ) ) ) % 16;
             if ( nSign >= 0 && nSign <= 9 )
                 pBuf[nInd] = nSign + '0';
             else if ( nSign >= 10 && nSign <= 15 )


More information about the Libreoffice-commits mailing list