Possible runtime bug in preprocessing of command line arguments passed to the D main

jfondren julian.fondren at gmail.com
Sun Oct 24 14:38:44 UTC 2021


On Sunday, 24 October 2021 at 14:21:52 UTC, Basile B. wrote:
> What do you think ?

I'm very surprised that this is even allowed. Apparently it's 
Linux userspace that normally complains about it: 
https://git.savannah.gnu.org/cgit/gnulib.git/tree/lib/progname.c#n54

The manpages just say

```
    v - execv(), execvp(), execvpe()
        The char *const argv[] argument is an array of pointers to 
null-terminated strings  that  represent
        the argument list available to the new program.  The first 
argument, by convention, should point to
        the filename associated with the file being executed.  The 
array of pointers must be terminated  by
        a null pointer.
```

With nothing to the contrary, I'd take "must be terminated by a 
null pointer" as "can't itself be a null pointer".

On OpenBSD this fails outright:

```
RET   execve -1 errno 14 Bad address
```

You can get `execv` from `core.sys.posix.unistd`


More information about the Digitalmars-d-learn mailing list