Bug 10457 – _d_toObject might fail with shared libraries

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2013-06-23T18:48:00Z
Last change time
2015-06-09T05:15:11Z
Assigned to
nobody
Creator
code

Comments

Comment #0 by code — 2013-06-23T18:48:14Z
This happens because the function uses a heuristic to distinguish Objects from Interfaces which depends on Interface.offset < 0x1_0000. With shared libraries the Object.classname.ptr can be located above 0x8000_0000 and subsequently the signed comparison in rt.cast_._d_toObject fails. https://github.com/D-Programming-Language/druntime/blob/e3750be8beca690225d980b60f9879d6f913eed4/src/rt/cast_.d#L39
Comment #1 by github-bugzilla — 2013-06-30T03:24:49Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/0c4d2ed412f2062e7821249d1fb33797469926ef fix Issue 10457 - _d_toObject might fail with shared libraries - Interface.offset can't be negative so it should be an unsigned value https://github.com/D-Programming-Language/druntime/commit/8d2d60f644e67a2c5f9533f5333e1167b127ebce Merge pull request #529 from dawgfoto/fix10457 fix Issue 10457 - _d_toObject might fail with shared libraries