Bug 10897 – btc, btr and bts shouldn't be safe

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-08-25T23:55:00Z
Last change time
2014-06-18T13:30:30Z
Assigned to
nobody
Creator
monarchdodra

Comments

Comment #0 by monarchdodra — 2013-08-25T23:55:39Z
As the title implies, their sig is: "pure nothrow @safe int btc(size_t* p, size_t bitnum);" The argument "bitnum" clearly implies array indexing. In this case, there is no bounds checking, which means the function can't be safe. Furthermore, they access data in an underhand fashion, potentially corrupting anything that is passed to them. Strangely enough, the functions "bt", *is* @system. In any case, they cannot be made @safe in any way shape or form.
Comment #1 by monarchdodra — 2013-08-25T23:58:41Z
Comment #2 by monarchdodra — 2013-08-28T13:52:53Z
Comment #3 by github-bugzilla — 2013-09-07T13:17:39Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/849629c8d251a9806394ed1e1ee525c05cd867cb Fix Issue 10897 - btc, btr and bts shouldn't be safe https://github.com/D-Programming-Language/dmd/commit/c7d4c376be3fc041f2f6bb29f37889ae05b7a3ea Merge pull request #2503 from monarchdodra/bt Fix Issue 10897 - btc, btr and bts shouldn't be safe
Comment #4 by github-bugzilla — 2013-09-07T13:17:43Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/2931e8cb9aac2b433a617bbcdc10bcb6da51a70a Fix Issue 10897 - btc, btr and bts shouldn't be safe https://github.com/D-Programming-Language/druntime/commit/557b946f1256e725c20e72c96ea5dbbb62ff095f Merge pull request #596 from monarchdodra/bt Fix Issue 10897 - btc, btr and bts shouldn't be safe
Comment #5 by code — 2014-06-18T13:30:30Z
Fixed since quite some while.