diff options
author | Dan Gohman <gohman@apple.com> | 2009-08-13 18:38:15 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2009-08-13 18:38:15 +0000 |
commit | 4e8e642eaa969db43b2a3ff6955abf3ca8b6789a (patch) | |
tree | ba78929829cb5e29083666e0f7f808919652f936 /lib/Support/raw_ostream.cpp | |
parent | 0ba50bb05661165f2b97f4526732f109a81100b5 (diff) |
Add an assert to check copy_to_buffer's precondition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78926 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r-- | lib/Support/raw_ostream.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index 5eaf7bf6a0..3ea5c9af83 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -222,6 +222,8 @@ raw_ostream &raw_ostream::write(const char *Ptr, size_t Size) { } void raw_ostream::copy_to_buffer(const char *Ptr, size_t Size) { + assert(Size <= OutBufEnd - OutBufCur && "Buffer overrun!"); + // Handle short strings specially, memcpy isn't very good at very short // strings. switch (Size) { |