You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@apr.apache.org by bu...@apache.org on 2014/12/02 13:21:44 UTC

[Bug 57295] New: apr_atoi64 truncating MSb on large apr_uint64_t number

https://issues.apache.org/bugzilla/show_bug.cgi?id=57295

            Bug ID: 57295
           Summary: apr_atoi64 truncating MSb on large apr_uint64_t number
           Product: APR
           Version: 1.5.0
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: carlosbar@gmail.com

Created attachment 32250
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32250&action=edit
Patch for apr_private.h (.\include\arch\win32)

apr_atoi64, under Windows 7 64 bits (not sure about other versions), MSVC 2008
64 bits binaries, is truncating the Most significant bit for a large unsigned
64 bits number.

e.g:

...

apr_uint64_t        ui64;
char                b[512];

ui64 = 0xffffffffffffffff;
apr_snprintf(b,sizeof(b),"%"APR_UINT64_T_FMT,ui64);
ui64 = (apr_uint64_t) apr_atoi64(b);

// at this point, ui64 is 0x7fffffffffffffff, which is wrong


issue seems to be with function: _strtoi64

snippet from apr_private.h:

/* MSVC 7.0 introduced _strtoi64 */
#if _MSC_VER >= 1300 && _INTEGRAL_MAX_BITS >= 64 && !defined(_WIN32_WCE)
#define APR_INT64_STRFN          _strtoi64
#endif

FIX: use _strtoui64 instead.

Patch attached for analysis.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


[Bug 57295] apr_atoi64 truncating MSb on large apr_uint64_t number

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57295

Carlos Barcellos <ca...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|                            |Windows 7

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org