Bug 21730 – null ptr dereferenced in ChunksImpl.opApply (SIGSEGV)
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2021-03-18T21:03:41Z
Last change time
2021-05-04T10:02:58Z
Keywords
pull
Assigned to
No Owner
Creator
kdevel
Comments
Comment #0 by kdevel — 2021-03-18T21:03:41Z
```three.d
import std.stdio;
void main ()
{
auto err1 = File ("/tmp/err1.txt", "w+x");
remove ("/tmp/err1.txt");
err1.close;
foreach (ubyte [] buf; chunks (err1, 4096))
stderr.writeln (buf);
}
```
(gdb) r
[...]
Program received signal SIGSEGV, Segmentation fault.
0xXXXXXXXXXXXXXXXX in std.stdio.ChunksImpl() (this=..., dg=...)
at [...]dmd2/linux/bin64/../../src/phobos/std/stdio.d:4711
4711 while ((r = trustedFread(f._p.handle, buffer)) > 0)
(gdb) p f
$1 = {_p = 0x0, _name = "/tmp/err1.txt"}
(related to Issue 21729)
Comment #1 by dlang-bot — 2021-05-01T14:47:59Z
@berni44 created dlang/phobos pull request #8025 "Fix Issues 21728, 21729 and 21730 (check for open file, before using trustedFread)" fixing this issue:
- Fix Issue 21730 - null ptr dereferenced in ChunksImpl.opApply (SIGSEGV)
https://github.com/dlang/phobos/pull/8025
dlang/phobos pull request #8025 "Fix Issues 21728, 21729 and 21730 (check for open file, before using trustedFread)" was merged into stable:
- 658474494640caa5b58a893f9745b00381c7ecf2 by berni44:
Fix Issue 21730 - null ptr dereferenced in ChunksImpl.opApply (SIGSEGV)
https://github.com/dlang/phobos/pull/8025