View Single Post
  #1 (permalink)  
Old 04-21-2004
kssreeram kssreeram is offline
Registered User
 
 
Join Date: Oct 2003
Posts: 11
Crash in IceUtil::Time caused by VC6 bug

Hi

There is a bug in VC6 which causes stack pointer corruption in try-catch blocks which create temporary objects containing __int64 members. The stack pointer corruption happens when an exception is thrown inside the try-catch block.

This problem affects Ice because IceUtil::Time has a __int64 member. Thus this can lead to unexpected crashes inside Ice where Time is used, and some error condition causes an exception to be thrown.

Here is simple program to reproduce the problem in VC6 :
Code:
class SomeClass {
public:
    static SomeClass StaticMethod() {
        return SomeClass();
    }

    ~SomeClass() {
    }

    __int64 _64bit;
};

int main(int argc, char **argv) {
    try {
        throw 0;

        SomeClass::StaticMethod();
    }
    catch( ... ) {
    }
    
    return 0;
}
As a workaround to this problem in our application, we've patched IceUtil::Time to not use a __int64 member. Instead it used two 32bit values, and emulates a 64-bit type.

Regards
Sreeram
Tachyon Technologies
Reply With Quote