Bug 19489 – Null function call results in no stack trace
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2018-12-15T04:25:23Z
Last change time
2019-12-28T17:56:52Z
Keywords
pull
Assigned to
No Owner
Creator
Ahmet Sait
Comments
Comment #0 by nightmarex1337 — 2018-12-15T04:25:23Z
void function() f = null;
f();
Calling a null function pointer results gives:
object.Error@(0): Access Violation
----------------
Program exited with code 1
void function() f = cast(void function())1;
f();
Calling a non-null function pointer gives:
object.Error@(0): Access Violation
----------------
0x00000001
0x00423FDB in _Dmain at D:\NX 1337\Projects\BlendUI\src\blendui\main.d(23)
0x00436353 in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll().__lambda1()
0x004362D5 in void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()
0x0043616F in _d_run_main
0x00424038 in main at D:\NX 1337\Projects\BlendUI\src\blendui\math\size.d(7)
0x00454FE9 in mainCRTStartup
0x76C28484 in BaseThreadInitThunk
0x771C302C in RtlValidSecurityDescriptor
0x771C2FFA in RtlValidSecurityDescriptor
Program exited with code 1
My quick glance at the trace handler source it seems like null is being used for determining length of a fixed size stack buffer. (sigh..) This is a rather frustrating bug and trivial to fix. I had to boot up linux and use gdb to just debug this nonsense.
Comment #1 by dlang-bot — 2019-12-08T17:11:19Z
@ahmetsait updated dlang/druntime pull request #2862 "Fix issue 19489 - Null function call results in no stack trace" fixing this issue:
- Fix issue 19489 - Null function call results in no stack trace
Removes questionable function address checks
https://github.com/dlang/druntime/pull/2862
Comment #2 by dlang-bot — 2019-12-28T17:56:52Z
dlang/druntime pull request #2862 "Fix issue 19489 - Null function call results in no stack trace" was merged into master:
- 1028578eaf0e4a0a7414c3b6d5a099bd529d3979 by Ahmet Sait:
Fix issue 19489 - Null function call results in no stack trace
https://github.com/dlang/druntime/pull/2862