Posts

Showing posts from September, 2004

Structured Exception Handling

http://www.microsoft.com/msj/0197/Exception/Exception.aspx

http://www.microsoft.com/msj/0898/bugslayer0898.aspx

http://groups.google.co.in/groups?hl=en&lr=&ie=UTF-8&selm=Xns94A2C525A6E9EnospamJochenKalmbach%40207.46.248.16&rnum=2

vtable layout and lookup

struct cA ;

struct A_vtbl
{
void (__stdcall* pfn_mem_fun)( struct cA* this, int v ) ;
void (__stdcall* pfn_mem_fun2)( const struct cA* this ) ;
void (__stdcall* pfn_mem_fun3)( struct cA* this ) ;
void (__stdcall* pfn_destructor)( struct cA* this ) ;
};

struct cA
{
struct A_vtbl* vptr ;
char c1 ;
int i ;
char c2[1] ;
};

void cfun( struct cA* pa )
{
//pa->mem_fun2() ;
pa->vptr->pfn_mem_fun2(pa) ;
//pa->mem_fun(100) ;
pa->vptr->pfn_mem_fun(pa,100);
}

type safety importance link

From -
http://www.securingjava.com/chapter-two/chapter-two-10.html

Why Type Safety Matters
Type safety is the most essential element of Java's security. To understand why, consider the following slightly contrived example. A calendar-management applet defines a class called Alarm. This class is represented in memory as shown in Figure 2.10. Alarm defines an operation turnOn, which sets the first field to true. The Java runtime library defines another class called Applet, whose memory layout is also shown in Figure 2.10. Note that the first field of Applet is fileAccessAllowed, which determines whether the applet is allowed access to files on the hard disk.
Figure 2.10 Type safety provides an important foundation for the Java security model.In this figure, two classes, Alarm and Applet, each include a number of fields. Setting the first field in these classes to "true" is not equivalent. Type safety checks ensure that any object a method may try to manipulate is of the pro…