[Issue 9381] New: package access can be abused and worked around

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 23 18:05:27 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9381

           Summary: package access can be abused and worked around
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: andrej.mitrovich at gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-01-23 18:05:26 PST ---
/a/m.d:
module a.m;
package void foo() { }

/user/a/workaround.d:
module a.workaround;
import a.m;
auto foo()
{
    return a.m.foo();  // free access!
}

/user/main.d:
module main;
import a.workaround;
void main()
{
    foo();
}

$ rdmd user/main.d

No compile errors!

Even though user/a/workaround is *not* part of the library defined in the 'a'
folder, it has free access to all package 'a' modules.

Package should probably be checked on a folder level and not just on a module
declaration level to make it useful.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list