Bug 16955 – std.process.spawnProcessImpl can crash due to alloca

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2016-12-07T17:40:00Z
Last change time
2017-01-16T23:25:42Z
Assigned to
nobody
Creator
atila.neves

Comments

Comment #0 by atila.neves — 2016-12-07T17:40:27Z
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.
Comment #1 by john.loughran.colvin — 2016-12-07T18:17:18Z
Comment #2 by github-bugzilla — 2016-12-11T19:12:56Z
Commits pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/aec837beca951d6e7194e93a08de6cb375230e42 Fix Issue 16955 - std.process.spawnProcessImpl can crash due to alloca https://github.com/dlang/phobos/commit/43a4d2cc1e879cbcd1809bfac765c6fef2532cb3 Merge pull request #4934 from John-Colvin/fix_spawn Fix Issue 16955 - std.process.spawnProcessImpl can crash due to alloca
Comment #3 by github-bugzilla — 2017-01-07T03:03:01Z
Commits pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/aec837beca951d6e7194e93a08de6cb375230e42 Fix Issue 16955 - std.process.spawnProcessImpl can crash due to alloca https://github.com/dlang/phobos/commit/43a4d2cc1e879cbcd1809bfac765c6fef2532cb3 Merge pull request #4934 from John-Colvin/fix_spawn
Comment #4 by deadalnix — 2017-01-09T00:32:54Z
*** Issue 17078 has been marked as a duplicate of this issue. ***
Comment #5 by github-bugzilla — 2017-01-16T23:25:42Z
Commits pushed to newCTFE at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/aec837beca951d6e7194e93a08de6cb375230e42 Fix Issue 16955 - std.process.spawnProcessImpl can crash due to alloca https://github.com/dlang/phobos/commit/43a4d2cc1e879cbcd1809bfac765c6fef2532cb3 Merge pull request #4934 from John-Colvin/fix_spawn