From fb338a98607d840177a50c35abd4d7702c39b46f Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 15 Jul 2013 16:40:10 -0700 Subject: [PATCH] Assert on type size invariant --- Subtrees/beast/TODO.txt | 2 ++ .../beast/modules/beast_crypto/math/beast_UnsignedInteger.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Subtrees/beast/TODO.txt b/Subtrees/beast/TODO.txt index a5faea1456..1402c9af32 100644 --- a/Subtrees/beast/TODO.txt +++ b/Subtrees/beast/TODO.txt @@ -2,6 +2,8 @@ BEAST TODO -------------------------------------------------------------------------------- +- Rename HeapBlock routines to not conflict with _CRTDBG_MAP_ALLOC macros + - Design a WeakPtr / SharedPtr / SharedObject intrusive system - Implement beast::Bimap? diff --git a/Subtrees/beast/modules/beast_crypto/math/beast_UnsignedInteger.h b/Subtrees/beast/modules/beast_crypto/math/beast_UnsignedInteger.h index 9d4f950ea3..a7460ddb0c 100644 --- a/Subtrees/beast/modules/beast_crypto/math/beast_UnsignedInteger.h +++ b/Subtrees/beast/modules/beast_crypto/math/beast_UnsignedInteger.h @@ -76,10 +76,10 @@ public: template UnsignedInteger & operator= (IntegerType value) { - static_bassert (sizeof (Bytes) >= sizeof (IntegerType)); + static_bassert (Bytes >= sizeof (IntegerType)); clear (); value = ByteOrder::swapIfLittleEndian (value); - memcpy (end () - sizeof (value), &value, sizeof (value)); + memcpy (end () - sizeof (value), &value, bmin (Bytes, sizeof (value))); return *this; }