www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1161] New: Access to private static members is allowed from other module.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161

           Summary: Access to private static members is allowed from other
                    module.
           Product: D
           Version: 1.012
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aarti interia.pl


-----------
module static_a;
import static_b;
void main() {
    Test.counter=5;
}
-----------
module static_b;
class Test {
private:
    static int counter=0;
}


-- 
Apr 18 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161






Adding the following line to expressions.c(VarExp::semantic) catches it:

// check access to VarDeclaration
accessCheck(loc, sc, NULL, var);


-- 
May 04 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161






I've compiled several tango modules with this fix in place and it has already
exposed two bugs in tango and no false positives so far.

;)


-- 
May 06 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161


tomas famolsen.dk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |trivial





This fix has been in place in LLVMDC for a long time, the change is trivial,
it's not yet produced any false positives, just found bugs ... could we please
get this into DMD ?


-- 
Sep 27 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161


matti.niemenmaa+dbugzilla iki.fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |matti.niemenmaa+dbugzilla ik
                   |                            |i.fi
           Severity|trivial                     |normal
           Keywords|                            |patch





-------
Severity doesn't mean how easy an issue is to fix. I set it back to "normal"
and added the "patch" keyword instead.

As an aside, does that patch also fix Issue 313? What about Issue 314?


-- 
Sep 27 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161






-------

 As an aside, does that patch also fix Issue 313? What about Issue 314?
No it doesn't, but 314 has a patch that could be adapted to fix both. I didn't apply it to LLVMDC since it'd break compatibility to DMD in a fairly major way. On the other hand, it *is* a bug; I'll look at it again. --
Sep 29 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161


tomas famolsen.dk changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|patch                       |





The fix I proposed is indeed broken (or accessCheck is), it causes protection
problems when instantiating imported templates passing private variables as
alias template parameters. I've removed it from LDC again. Removing patch
keyword


-- 
Dec 10 2008
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161




Partially fixed in issue 5385.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 18 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1161


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich gmail.com



02:25:48 PST ---

 Partially fixed in issue 5385.
Which testcases did I miss? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 19 2012