[Issue 23654] execv_: toAStringz: memory corruption
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jan 26 12:57:07 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23654
--- Comment #1 from kdevel <kdevel at vogtner.de> ---
(In reply to kdevel from comment #0)
> private void toAStringz(in string[] a, const(char)**az)
> {
> import std.string : toStringz;
> foreach (string s; a)
> {
> *az++ = toStringz(s);
> }
> *az = null;
> auto argv_ = cast(const(char)**)core.stdc.stdlib.malloc((char*).sizeof *
> (1 + argv.length));
It seems to be GC-related. The unittest passes, if
- the GC is disabled, or
- the memory is allocated with new:
$ dmd -checkaction=context -unittest -main -run tassnd-no-gc.d
8192
16384
32768
65536
131072
1 modules passed unittests
$ dmd -checkaction=context -unittest -main -run tassnd-no-malloc.d
8192
16384
32768
65536
131072
1 modules passed unittests
--
More information about the Digitalmars-d-bugs
mailing list