Opened 10 years ago

Closed 7 years ago

#7008 closed Bugs (fixed)

boost/serialization/detail/get_data.hpp leaks STD macro

Reported by: Jonathan Jones <jonathan.jones@…> Owned by: Robert Ramey
Milestone: To Be Determined Component: serialization
Version: Boost 1.44.0 Severity: Problem
Keywords: Cc: dave.lowell@…

Description

The header boost/serialization/detail/get_data.hpp defines the macro STD for local use in the header. However, it does not un-define the macro at the end of the header, causing a commonly used name to be leaked as a macro for anything included after this header.

Attachments (1)

get_data.hpp (1.3 KB ) - added by dave.lowell@… 7 years ago.
patched version of get_data.hpp with unconditional undef

Download all attachments as: .zip

Change History (7)

comment:1 by Robert Ramey, 10 years ago

Resolution: fixed
Status: newclosed

OK - fixed on my machine - will eventually arrive at release

comment:2 by dave.lowell@…, 7 years ago

Cc: dave.lowell@… added
Resolution: fixed
Status: closedreopened

The definition of STD in get_data.hpp is unconditional. What it's defined to depends on whether STLport is being used, but it's always defined to something.

However, the undef that's been added is conditional - STD is only undefined when STLport is being used. If it's not used, then it looks like the definition still leaks.

by dave.lowell@…, 7 years ago

Attachment: get_data.hpp added

patched version of get_data.hpp with unconditional undef

comment:3 by Robert Ramey, 7 years ago

Resolution: invalid
Status: reopenedclosed

Sorry I'm not seeing this is the current code which looks like:

#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
#define STD _STLP_STD
#else
#define STD std
#endif
...
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
#undef STD
#endif

in reply to:  3 comment:4 by jonathan.jones@…, 7 years ago

Replying to ramey:

Sorry I'm not seeing this is the current code which looks like:

#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
#define STD _STLP_STD
#else
#define STD std
#endif
...
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
#undef STD
#endif

What happens if neither SGI_STL_PORT nor _STLPORT_VERSION are defined?

The first block #defines STD to "std". The second block does not #undefine STD, hence the macro definition for STD leaks.

comment:5 by jonathan.jones@…, 7 years ago

Resolution: invalid
Status: closedreopened

comment:6 by Robert Ramey, 7 years ago

Resolution: fixed
Status: reopenedclosed

OK - I don't know what I was thinking.

Fixed again now

Note: See TracTickets for help on using tickets.