Modify

Opened 6 years ago

Closed 3 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@… 3 years ago.
patched version of get_data.hpp with unconditional undef

Download all attachments as: .zip

Change History (7)

comment:1 Changed 6 years ago by Robert Ramey

Resolution: fixed
Status: newclosed

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

comment:2 Changed 3 years ago by dave.lowell@…

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.

Changed 3 years ago by dave.lowell@…

Attachment: get_data.hpp added

patched version of get_data.hpp with unconditional undef

comment:3 Changed 3 years ago by Robert Ramey

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

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

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 Changed 3 years ago by jonathan.jones@…

Resolution: invalid
Status: closedreopened

comment:6 Changed 3 years ago by Robert Ramey

Resolution: fixed
Status: reopenedclosed

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

Fixed again now

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Robert Ramey.
The resolution will be deleted.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.