Home Help Center

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 :
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

Comments

  • bernardbernard Jupiter, FLAdministrators, ZeroC Staff Bernard NormierOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi Sreeram,

    I was not able to reproduce this problem with your test case. I tried to compile with /GX /O2 and /GX /Zi, using Visual C++ 6 SP5:

    Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86

    And purify did not show any problem.

    What am I missing?

    Thanks,
    Bernard
  • kssreeramkssreeram Member
    Looks like the bug is present only if VC6 SP5 ProcessorPack is installed. I just tested the program on two machines which have processor pack installed, and on two other machines which only have plain VC6 SP5. The crash didnt happen if the processor pack is not installed.

    Also the OS doesnt report an access violation if i run the program outside the debugger.

    Incidentally i also noticed a comment regarding this very same issue in Ice 1.2.0 source code. The comment has been removed in 1.3.0.

    In Ice 1.2.0 look in src/Ice/Connection.cpp line 991.

    Regards
    Sreeram
    Tachyon Technologies
  • marcmarc FloridaAdministrators, ZeroC Staff Marc LaukienOrganization: ZeroC, Inc.Project: The Internet Communications Engine ZeroC Staff
    Right, we removed this, because exception handling is "officially broken" with the processor pack, so we don't support the processor pack for Ice. And according to Microsoft, they have no intention to fix this for VC++ 6.0.
Sign In or Register to comment.