Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 28249 invoked from network); 11 Aug 2010 17:10:05 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 11 Aug 2010 17:10:05 -0000 Received: (qmail 88126 invoked by uid 500); 11 Aug 2010 16:10:05 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 88052 invoked by uid 500); 11 Aug 2010 16:10:04 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Delivered-To: moderator for dev@apr.apache.org Received: (qmail 72636 invoked by uid 99); 11 Aug 2010 16:03:16 -0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=RCVD_IN_DNSWL_NONE,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) MIME-Version: 1.0 Sender: hyrum@hyrumwright.org X-Originating-IP: [128.83.198.82] In-Reply-To: References: Date: Wed, 11 Aug 2010 11:02:46 -0500 X-Google-Sender-Auth: CUV2voGI6Eaf4DDfgZ5BNTZU0e0 Message-ID: Subject: Re: %lld/%llu not handled by apr_vformatter From: "Hyrum K. Wright" To: Chris Knight Cc: APR Developer List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org Unfortunately, you seem to have found the same bug I uncovered in March: http://mail-archives.apache.org/mod_mbox/apr-dev/201003.mbox/%3Cb51ffb6f100= 3100926n22c1dd79id9696972b23a153a@mail.gmail.com%3E To my knowledge it hasn't been fixed, thought that thread does include a somewhat hacky patch to work around the issue. Perhaps it will be of use to you. -Hyrum On Wed, Aug 11, 2010 at 10:51 AM, Chris Knight wrote: > I spent half-a-day yesterday trying to figure out why I was crashing in a= pr_psprintf on a strlen until I realized that my "%llu%s" format string was= causing it to use my long long int as a char *. > > Needless to say, no harm in adding support for %ll[du] yes? > > Ah, 64-bit fun for everyone.... > > Example code: > > #include > #include > #include > #include > > int main(int argc, char **argv) { > =A0 =A0apr_pool_t *pool =3D NULL; > =A0 =A0char *s =3D "hello world"; u_int64_t v =3D 12345678; > > =A0 =A0apr_pool_initialize(); apr_pool_create(&(pool), NULL); > =A0 =A0printf("%llu%s", v, s); // works > =A0 =A0char *f =3D apr_psprintf(pool, "%llu%s", v, s); // segfault on str= len > =A0 =A0printf("%s\n", f); > }