Opened 9 years ago

Last modified 9 years ago

#9218 new Patches

Invalid pointer dereference on MSVC debug builds

Reported by: Gavin Lambert <gavinl@…> Owned by: timblechmann
Milestone: To Be Determined Component: lockfree
Version: Boost 1.53.0 Severity: Problem
Keywords: windows msvc debug Cc:

Description

This is rare (so far only observed with race detection simulation), but due to the MSVC DebugCRT initialising "new" allocated memory to 0xCC instead of 0x00 the queue will miss a null pointer check in a particular race condition and try to dereference 0xCCCCCCCC.

If you're interested I could probably get a log of the exact sequence of operations that leads to this error, but it's pretty wordy.

Attachments (1)

dcas_msvc_debug.patch (410 bytes ) - added by Gavin Lambert <gavinl@…> 9 years ago.
Ensures pointer is initialised to null rather than 0xCCCCCCCC

Download all attachments as: .zip

Change History (2)

by Gavin Lambert <gavinl@…>, 9 years ago

Attachment: dcas_msvc_debug.patch added

Ensures pointer is initialised to null rather than 0xCCCCCCCC

comment:1 by Gavin Lambert <gavinl@…>, 9 years ago

Note that the attached patch changes it unconditionally. If you really want to leave it uninitialised for performance you could slap some #if checks around it for MSVC and _DEBUG. But this might leave it vulnerable if some other compilers do something similar.

Note: See TracTickets for help on using tickets.