www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - toUTF8 seg-v on bad input

reply BCS <ao pathlink.com> writes:
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.
Apr 08 2007
parent reply Thomas Kuehne <thomas-dloop kuehne.cn> writes:
-----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-----
Apr 22 2007
parent BCS <BCS pathlink.com> writes:
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.
Apr 23 2007