www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16955] New: std.process.spawnProcessImpl can crash due to

https://issues.dlang.org/show_bug.cgi?id=16955

          Issue ID: 16955
           Summary: std.process.spawnProcessImpl can crash due to alloca
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: atila.neves gmail.com

in process.d:475:

pollfd* pfds = cast(pollfd*)alloca(pollfd.sizeof * maxToClose);

maxToClose is the maximum number of file descriptors - 3. Multiplied by
pollfd.sizeof this is usually far lower than the size of the stack. On systems
configured to be servers however...

There should at least be a check here and fall back to heap allocation.

The symptom of this bug is that functions like std.process.execute fail and
it's hard to know why.

--
Dec 07 2016