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





------- Comment #1 from tomas famolsen.dk  2008-05-04 21:10 -------
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





------- Comment #2 from tomas famolsen.dk  2008-05-06 22:48 -------
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




------- Comment #3 from tomas famolsen.dk  2008-09-27 09:14 -------
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




------- Comment #4 from matti.niemenmaa+dbugzilla iki.fi  2008-09-27 11:15
-------
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





------- Comment #5 from kamm-removethis incasoftware.de  2008-09-30 00:37
-------
(In reply to comment #4)
 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 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                       |




------- Comment #6 from tomas famolsen.dk  2008-12-10 06:58 -------
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