diff options
author | Timotej Kapus <timotej.kapus13@imperial.ac.uk> | 2015-06-22 01:09:32 +0100 |
---|---|---|
committer | Dan Liew <daniel.liew@imperial.ac.uk> | 2015-12-17 19:45:03 +0000 |
commit | 901bd2c429ac51dd143a2a4bfc07c382dfb21e72 (patch) | |
tree | 0c895124938a79f67904bd11fdb9f4976b3be298 /lib/Core | |
parent | 9298b60d25da080b0c81682afe58d4a8d9e1971b (diff) | |
download | klee-901bd2c429ac51dd143a2a4bfc07c382dfb21e72.tar.gz |
Fixed a bug with how non power 2 values were written to memory, added test for it
Diffstat (limited to 'lib/Core')
-rw-r--r-- | lib/Core/Memory.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Core/Memory.cpp b/lib/Core/Memory.cpp index 50e9aa9f..47bc7576 100644 --- a/lib/Core/Memory.cpp +++ b/lib/Core/Memory.cpp @@ -529,7 +529,10 @@ void ObjectState::write(unsigned offset, ref<Expr> value) { // Check for writes of constant values. if (ConstantExpr *CE = dyn_cast<ConstantExpr>(value)) { Expr::Width w = CE->getWidth(); - if (w <= 64) { + //assuming width can't be 0 so I can miss half of power of two check + assert(w > 0); + //also checks that w is a power of two + if (w <= 64 && !(w & (w - 1))) { uint64_t val = CE->getZExtValue(); switch (w) { default: assert(0 && "Invalid write size!"); |