Opened 13 years ago

Closed 13 years ago

#3549 closed Bugs (fixed)

Crash from serializing an unregistered class

Reported by: jeff.jackowski@… Owned by: Robert Ramey
Milestone: Boost 1.41.0 Component: serialization
Version: Boost 1.40.0 Severity: Problem
Keywords: Cc:

Description

If an attempt is made to serialize an unregistered class and the program gets to line 377 of boost/archive/detail/oserializer.hpp (revision 57090), the program will crash from dereferencing a null pointer. To fix it, comment out or remove line 380, and take out the comma on the line before it. This may provide less debugging information than intended, but I'm not sure that information is available since it was supposed to be coming from the null pointer.

Change History (5)

comment:1 by Robert Ramey, 13 years ago

Hmmm - where exactly does this crash?

archive_exception.cpp line # 40 constructs this exception and it explicitly checks for a null pointer.

Need more information here.

Robert Ramey

in reply to:  1 comment:2 by jeff.jackowski@…, 13 years ago

Replying to ramey:

Hmmm - where exactly does this crash?

archive_exception.cpp line # 40 constructs this exception and it explicitly checks for a null pointer.

Need more information here.

Robert Ramey

It crashes before it can construct the exception. The code I'm looking at (boost/archive/detail/oserializer.hpp, line 376) is:

if(NULL == true_type){

boost::serialization::throw_exception(

archive_exception(

archive_exception::unregistered_class, true_type->get_debug_info()

)

);

}

Evaluating the second parameter to archive_exception will dereference a null pointer.

comment:3 by Robert Ramey, 13 years ago

fixed on my machine - will migrate to trunk and beyond.

Note: I suspect that this will only occur when RTTI is not enabled for one's machine.

Robert Ramey

comment:4 by jeff.jackowski@…, 13 years ago

The problem occurred for me with MSVS 2008 with RTTI enabled.

comment:5 by Robert Ramey, 13 years ago

Resolution: fixed
Status: newclosed

In case I did make a change so I I don't see how this can happen. It's the best I can do without a failing test case.

Robert Ramey

Note: See TracTickets for help on using tickets.