www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 20778] New: exception messages with nulls within are treated


          Issue ID: 20778
           Summary: exception messages with nulls within are treated
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: regression
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: elpenguino+D gmail.com

throw new Exception("hello\0world!");
As of DMD 2.091.1, the printed message is inconsistent between platforms. On
windows, the full string is printed. on other platforms, only "hello" is

I would expect the entire string to be printed in all cases, but it seems some
code in druntime expects the latter case instead (see
core.internal.array.casting.onArrayCastError, for example).

This inconsistency appears to have been introduced between 2.064 and 2.065,
when the default exception printer was changed from using write() to fprintf()
on non-windows platforms.

Apr 27 2020