Commit Graph

9 Commits

Author SHA1 Message Date
Mathias Agopian
53ff133b03 fix a possible memory corruption in debug builds
TrackingPolicy::Debug didn't store the base pointer of the Area, and
instead relied on the first allocation to discover it, however, because
of alignment, the first allocation may not match the base pointer.
Because of that there could be an overflow in onRewind(), i.e. we
could rewind to a pointer before the (wrongly computed) base. This
overflow caused the debug memset to go awry and stomped on memory.

This is fixed by passing the base pointer to the constructor of the
TrackingPolicy. This base pointer could be nullptr with certain
allocators, but in that case, onReset/onRewind should never be called;
and this is enforced at compile time.

Also fixed a (luckily) harmless buffer overflow when preparing the
dynamic lights, if the number of lights wasn't a multiple of 4. This
was harmless because we use a linear allocator, so overflows are not 
really overflows.
2019-11-07 10:03:41 -08:00
Benjamin Doherty
21f0aa5fb4 Enable custom allocator test for Windows 2019-01-30 16:05:49 -08:00
Mathias Agopian
8bdae79536 added rebind copy-ctor to STLAllocator
this should fix the build on windows debug
2019-01-30 16:05:49 -08:00
Mathias Agopian
0bdb6b8a8a workaround a compile error with some compilers 2019-01-30 16:05:49 -08:00
Mathias Agopian
07c1dbb5f4 fix typo causing a memory corruption in STLAllocator<>
We were allocating n*sizeof(n) instead of n*sizeof(T). Thankfully, 
we were not using STLAllocator anywhere.
2019-01-23 19:14:28 -08:00
Mathias Agopian
f011a212bd Minor clean-ups of Program 2018-11-13 16:02:44 -08:00
Mathias Agopian
f8f24f492f minor typo / spelling / clang-tidy fixes (#468)
* Minor clean-ups

- fix a couple usage of std::function
- fix a couple usage of std::string
- remove ALIGN_LOOP, which didn't work
- fix a couple explicit/noexcept
- virtual -> override

* Fix spelling typos and other minor clang-tidy
2018-11-08 11:50:00 -08:00
Mathias Agopian
e580bfed56 Fix allocator test when --gtest_repeat is used 2018-11-06 13:21:33 -08:00
Romain Guy
b3d758f3b3 Initial commit 2018-08-03 10:38:22 -07:00