apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 57295] New: apr_atoi64 truncating MSb on large apr_uint64_t number
Date Tue, 02 Dec 2014 12:21:44 GMT

            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.



apr_uint64_t        ui64;
char                b[512];

ui64 = 0xffffffffffffffff;
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

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

View raw message