Boost logo

Boost :

Subject: Re: [boost] [Serialization] Bizarre bug
From: troy d. straszheim (troy_at_[hidden])
Date: 2009-08-03 13:51:39


Jarl Lindrud wrote:
> There is a rather bizarre bug in Boost.Serialization, that was
> reported on this list three years ago:
>
> http://article.gmane.org/gmane.comp.lib.boost.devel/147010/match=serialization
> +bizarre+bug
>
> To sum up, a piece of code that is never even executed, is causing a
> serialization error in a different part of the program.
>
> Unfortunately it seems that this bug was never fixed - I just tried
> it on Boost 1.39.0, and the bug is still there.
>
> Any chance something can be done about it?
>
> For reference, here is the sample program that reproduces the issue:
>

Looks like UB to me. From the C++ standard:

Note: in particular, a null reference cannot exist in a well-defined
program, because the only way to create such a reference would be to
bind it to the "object" obtained by dereferencing a null pointer,
which causes undefined behavior. (§ 8.3.2, ¶ 4)

There is plenty of stuff out on the net about this; I find this thread
pretty entertaining:

http://stackoverflow.com/questions/1110111/what-part-of-dereferencing-null-pointers-causes-undesired-behavior/1110146#1110146

-t


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk