Thread overview
[Issue 19825] Memory corruption involving lazy variadic, stdio and json
Apr 27, 2019
RazvanN
Apr 27, 2019
ag0aep6g
May 25, 2019
Dlang Bot
April 27, 2019
https://issues.dlang.org/show_bug.cgi?id=19825

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
This looks like a phobos error, not a dmd one.

--
April 27, 2019
https://issues.dlang.org/show_bug.cgi?id=19825

ag0aep6g <ag0aep6g@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |ag0aep6g@gmail.com

--- Comment #2 from ag0aep6g <ag0aep6g@gmail.com> ---
Reduced test case:

----
import std.stdio;

struct JSONValue
{
    TaggedUnion payload;
}

struct TaggedUnion
{
    size_t[2] m_data;
    int m_kind;

    JSONValue opIndex(size_t i)
    {
        return JSONValue();
    }
}

void yap(lazy JSONValue arg)
{
    writeln(arg);
}

struct Foo
{
    int a;
    string name;
}

Foo makeFoo()
{
    JSONValue root;
    yap(root.payload[0].payload[0].payload[0]);

    Foo foo;
    return foo;
}

void main()
{
    auto foo = makeFoo();
    writeln(foo.name); // Garbled output, then an exception
}
----

--
May 23, 2019
https://issues.dlang.org/show_bug.cgi?id=19825

Suleyman Sahmi (سليمان السهمي) <sahmi.soulaimane@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sahmi.soulaimane@gmail.com
           Assignee|nobody@puremagic.com        |sahmi.soulaimane@gmail.com

--
May 25, 2019
https://issues.dlang.org/show_bug.cgi?id=19825

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #9853 "Fix issue 19825 - Memory corruption with lazy parameter" was merged into stable:

- 7923db297e76946f003de080603c5ac1dfaca338 by سليمان السهمي  (Suleyman Sahmi):
  Fix issue 19825

https://github.com/dlang/dmd/pull/9853

--