[Uim] reliability fix: uim-fep.c

Etsushi Kato ek.kato at gmail.com
Wed Apr 4 15:53:54 EEST 2007


Hi Iwata-san,

On 3/30/07, Iwata <iwata at quasiquote.org> wrote:
> "Etsushi Kato" <ek.kato at gmail.com> writes:
>
> > Thanks for your patch.  I haven't checked you patch in detailed yet, I
> > noticed one missing thing about asprintf replacement.  IIRC, some
> > version of SUN OS (Solaris?) have broken vsnprintf, so if you use
> > bsd-asprintf.c you need to use bsd-snprintf.c as well and
> > corresponding check with configure.ac.  Could you revise the patch to
> > use that?
>
> what hypocrite os is.
> Right, I wrote new patch, copied configure.ac entry from openssh-portable,
> and zapped same functions in xim/util.cpp.

I really appliciate your work.  This is what I thought a while ago.

>  http://quasiquote.org/patches/uim-fepp1.diff.gz
>
> I cannot test under BROKEN_SNPRINTFed environment, sorry.

No problem.  IMO, openssh code is well tested totally.

> BTW, I append strtonum(3) to this patch.
> I suggest replacing atoi(3) and strtol*(3) to strtonum.
>
> atoi is poor parser and no error checking such as overflow.
>
> strto* is better than atoi, but, in uim, lack correct handling.
> For example (from 'man strtol' in OpenBSD),
>
>   char *ep;
>   int ival;
>   long lval;
>
>   errno = 0;
>   lval = strtol(buf, &ep, 10);
>   if (buf[0] == '\0' || *ep != '\0')
>     goto not_a_number;
>   if ((errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN)) ||
>       (lval > INT_MAX || lval < INT_MIN))
>          goto out_of_range;
>   ival = lval;
>
> strtonum is easy to use (but ugly) and works correctly. such as
>
>   int iterations;
>   const char *errstr;
>
>   iterations = strtonum(optarg, 1, 64, &errstr);
>   if (errstr)
>     errx(1, "number of iterations is %s: %s", errstr, optarg);
>
> Please read CAVEATS.
>
>   http://www.openbsd.org/cgi-bin/man.cgi?query=atoi&sektion=0&format=html#end

I see.  I'll integrate your patch soon.  But since current trunk seems
to be unstable for me I'll commit after the unsuitability is resolved.

YamaKen, could you update the sigscheme or libgcroots code?  I got
segmentation falut with uim-fep and uim-xim with current code.

Cheers,
-- 
Etsushi Kato
ek.kato at gmail.com



More information about the uim mailing list