NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: lib/60413: iconv_samples test crashes on sparc*



The following reply was made to PR lib/60413; it has been noted by GNATS.

From: Robert Elz <kre%munnari.OZ.AU@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: lib/60413: iconv_samples test crashes on sparc*
Date: Mon, 06 Jul 2026 00:55:40 +0700

 That particular one seems to be caused by modules/citrus_viqr.c
 wherein appears
 
 typedef struct {
         unsigned char chlen;
         char ch[MB_LEN_MAX];
 } _VIQRState;
 
 and the sizeof that is taken as the state size.   One way to fix
 it would be to set an alignment on that, to at least sizeof(int)
 or another might be incitrus_iconv_std.c  where in 
 _citrus_iconv_std_iconv_init_context() it does
 
         szpssrc = _stdenc_get_state_size(is->is_src_encoding);
         szpsdst = _stdenc_get_state_size(is->is_dst_encoding);
 
         sz = (szpssrc + szpsdst)*2 + sizeof(struct _citrus_iconv_std_context);
 
 Note that it goes on to:
 
 	        sc = malloc(sz);
         if (sc == NULL)
                 return errno;
 
         ptr = (char *)&sc[1];
         if (szpssrc)
                 init_encoding(&sc->sc_src_encoding, is->is_src_encoding,
                               ptr, ptr+szpssrc);
 
 and that ptr+szpssrc is (I think) the void * which ends up being misaligned,
 but the init of ptr looks a bit casual to me as well,
 
 There won't be anything new/rececntly changed about any of this, just
 no-one ever tried to do this kind of conversion on a sparc (anything with
 real alignment mandates) before.
 
 kre
 
 



Home | Main Index | Thread Index | Old Index