toUTF8 seg-v on bad input

BCS BCS at pathlink.com
Mon Apr 23 11:30:44 PDT 2007


Thomas Kuehne wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> BCS schrieb am 2007-04-08:
> 
>>If std.utf.toUTF8(dchar[]) is given bad input it sometimes seg-v's. DMD also 
>>seg-v's if the same input undergoes a dchar[] -> char[] translation at compile 
>>time. I'll post a string that does it when I find another case.
> 
> 
> Are you sure that toUTF8(char[]) segfaulted? The only case I see would
> be elements with values above 0x10FFFF, though you should file a bug for
> that case because Phobos uses "assert(0)" instead of "throw ...".
> 
> Thomas
> 
> 
> -----BEGIN PGP SIGNATURE-----
> 
> iD8DBQFGK81ELK5blCcjpWoRAhxZAJ92nt6H2ZIwwgVQk3OdziQXAzCqjQCfZe34
> MdcZXk3amyspA9M5ylW1TOQ=
> =MFzd
> -----END PGP SIGNATURE-----

That may well have been the case, I was dealing with UTF convention code 
what I started seeing the error. What I would rely like to see is a 
cantFailToUTF8 function that will give you something no matter what it 
is given. It would be handy for debug output.


More information about the Digitalmars-d-bugs mailing list