[aspectc-user] On the subject of field access
denismo at yahoo.com
Tue Oct 30 13:39:43 CET 2007
I've been investigating various techniques for addressing memory corruption problem. I realized that AspectC++ can help with that, unfortunately it requires interception of field and pointer accesses, which is not yet part of AspectC++. Nevertheless, I thought I'd share my thoughts with you hoping that it might give you some additional justification for implementing it, or you might propose an alternative solution, or anything else useful.
I've got two ideas.
1. Have a class checksum. Use aspects to capture the moment of class modification and update the checksum. Use aspects or an object monitor to monitor checksums. This will not prevent memory corruption, but will at least capture it much sooner.
2. Tag each field and a compound memory object with a unique tag mandating a special kind of access. For example, class instance pointer can only be used for field access, vtable only for method execution. Each field will have a unique id of the field, so that its memory can only by access when you access this particular field, not as a raw pointer or some other field. You can verify that it is a class instance pointer that is passed to a member method or as a parameter to a function. This will catch the memory corruption as soon as the illegal access happens.
I think some of these checks can be done already using existing functionality of AspectC++ (for example, check for Target being an object of a particular class), but some would require ability to intercept field access. What is you opinion?
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the aspectc-user