Skip to content

std.file.rename segfaults on null string on Windows #10727

Closed

Description

@dkorpel
import std.file;
void main()
{
    string f = null;
    rename("", f);
    rename(f, "");
}

This segfaults on Windows. When trying to create an Exception message string, it calls wcslen(null):

f = to!(typeof(f))(fromz[0 .. wcslen(fromz)]);

The C string is null because of:

static if (isSomeString!From)
{
if (str is null)
{
res._length = 0;
res._ptr = null;
return res;
}
}

Activity

  1. added theissue type on Apr 1, 2025
  2. added
    Good First Issue
    on Apr 1, 2025
  3. added 5 commits that reference this issue on Apr 3, 2025
    906afce
    555ed34
    35161f0
    76c3f78
    47a9be0
  4. added a commit that references this issue on Apr 5, 2025
    35977c8
  5. 0xEAB commented on May 1, 2025

    @0xEAB
    Member

    Is there anything left to fix that #10736 didn’t tackle?

  6. 0xEAB commented on Feb 1, 2026

    @0xEAB
    Member

    @dkorpel *ping*
    Would you mind taking a glimpse at this (since you’ve reported it)?

  7. 0xEAB commented on Feb 22, 2026

    @0xEAB
    Member

    Feel free to reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First Issue

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions