uncaught exceptions: stack trace truncated at NUL char

Paul Backus snarwin at gmail.com
Sun Dec 13 22:40:53 UTC 2020


On Sunday, 13 December 2020 at 21:22:16 UTC, kdevel wrote:
> On Sunday, 13 December 2020 at 20:58:42 UTC, rikki cattermole 
> wrote:
>
> [...]
>
>> String literals are null terminated by the compiler. It is 
>> very useful for communicating with C.
>
> Sure, but in the example given there is an embedded NUL which 
> as part
> of an exception msg. If caught everything works as expected, 
> but if
> the stack is unwound the information is lost due to truncation.

This is definitely a bug. The problem is that the D runtime uses 
`fprintf` to print the exception's error message, when it should 
be using `fwrite`:

https://github.com/dlang/druntime/blob/v2.094.2/src/rt/dmain2.d#L733


More information about the Digitalmars-d-learn mailing list