On Dec 10, 2007 9:55 PM, Karl Fogel <kfogel@red-bean.com> wrote:
> "Dongsheng Song" <dongsheng.song@gmail.com> writes:
> > Could you use "llu" instead of "APR_UINT64_T_FMT", otherwise:
> >
> > $ ../../tools/po/po-update.sh zh_CN
> > Building subversion.pot...
> > ../libsvn_repos/reporter.c:168: warning: Although being used in a
> > format string position, the msgid is not a valid C format string.
> > Reason: The string ends in the middle of a directive.
>
> Hrm. I hate to not use the mechanism provided by APR for exactly this
> purpose. Is there any way to shut off that warning for a specific
> string?
No. xgettext doesn't expand defines, so it doesn't know you're
concatenating strings there.
What we do in other places is: apr_psprintf the number into a string
and insert the %s format specifier in the error string.
HTH,
Erik.
>
>
> > 2007/12/10, kfogel@tigris.org <kfogel@tigris.org>:
> >> Author: kfogel
> >> Date: Sun Dec 9 15:37:55 2007
> >> New Revision: 28368
> >>
> >> Log:
> >> * subversion/libsvn_repos/reporter.c
> >> (read_string): Protect against a highly unlikely wraparound in
> >> allocation size, for the children's sake.
> >>
> >> Found by: Timo Sirainen <tss@iki.fi>
> >> Review by: glasser
> >> danderson
> >>
> >>
> >> Modified:
> >> trunk/subversion/libsvn_repos/reporter.c
> >>
> >> Modified: trunk/subversion/libsvn_repos/reporter.c
> >> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_repos/reporter.c?pathrev=28368&r1=28367&r2=28368
> >> ==============================================================================
> >> --- trunk/subversion/libsvn_repos/reporter.c (original)
> >> +++ trunk/subversion/libsvn_repos/reporter.c Sun Dec 9 15:37:55 2007
> >> @@ -157,6 +157,18 @@
> >> char *buf;
> >>
> >> SVN_ERR(read_number(&len, temp, pool));
> >> +
> >> + /* Len can never be less than zero. But could len be so large that
> >> + len + 1 wraps around and we end up passing 0 to apr_palloc(),
> >> + thus getting a pointer to no storage? Probably not (16 exabyte
> >> + string, anyone?) but let's be future-proof anyway. */
> >> + if (len + 1 < len)
> >> + {
> >> + return svn_error_createf(SVN_ERR_REPOS_BAD_REVISION_REPORT, NULL,
> >> + _("Invalid length (%" APR_UINT64_T_FMT ") "
> >> + "when about to read a string"), len);
> >> + }
> >> +
> >> buf = apr_palloc(pool, len + 1);
> >> SVN_ERR(svn_io_file_read_full(temp, buf, len, NULL, pool));
> >> buf[len] = 0;
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> >> For additional commands, e-mail: svn-help@subversion.tigris.org
> >>
> >>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Dec 15 14:53:52 2007