Commit Graph

5 Commits

Author SHA1 Message Date
Mark Olesen
59da4cf56d STYLE: use uintptr_t cast instead of long when reporting addresses 2019-04-29 08:15:48 +02:00
Mark Olesen
eaa3da72c5 ENH: extend size of NullObject for safer reinterpret cast
- previously had a single pointer/value zeros (8 bytes), this meant
  that the reinterpret cast to a List would yield a reference that
  could be unsafe under certain conditions.

  Eg,
     const labelList& myList = labelList::null();

     Info<< myList.size() << nl; // OK since size is the first parameter

     SubList<label>(myList, 0);  // Unsafe

  The SubList usage is unsafe since it passes in pointer and size into
  the underlying UList. However, the pointer from the labelList::null()
  will be whatever happens to be around in memory immediately after the
  NullObject singleton. This is mostly not a problem if the List size
  is always checked, but does mean that the data pointer is rather
  dubious.

- Increase the size of the nullObject singleton to 32 bytes of zeros
  to ensure that most reinterpret casting will not result in objects
  that reference arbitrary memory.

  The 32-byte data size is rather arbitrary, but covers most basic
  containers.
2019-02-07 11:13:13 +01:00
Mark Olesen
1883a872a1 STYLE: adds comments in empty Make/options files
- easier when making modifications

STYLE: spelling in topoSetSource comments
2018-11-13 15:21:13 +01:00
Mark Olesen
0298c02b2d ENH: ensure nullObject is large enough for reinterpret
- previously occupied 1 byte. Now occupies enough to hold a pointer,
  which helps if using reinterpret_cast to something that has some
  member content.
2017-05-01 22:39:36 +02:00
Henry
f4596ad247 Resolve issues relating to compilation with clang-3.5.0 2014-12-15 22:38:10 +00:00