about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2017-07-19 16:48:16 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2017-07-19 16:48:16 +0100
commitd7c2deaa9c3762a3735029d408ede82d5c046433 (patch)
tree7ffe6cdd8f30354dcd04fb7b378a1cedd1a55a2f
parentcc1a60141d01cf13a222db05e18f29f9bda40921 (diff)
downloadklee-d7c2deaa9c3762a3735029d408ede82d5c046433.tar.gz
Fixes bug in TreeStreamWriter::write reported by @gladtbx in #562. Also removes commented out code from that function.
-rw-r--r--lib/Support/TreeStream.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/Support/TreeStream.cpp b/lib/Support/TreeStream.cpp
index ef59b2a9..a0e1596f 100644
--- a/lib/Support/TreeStream.cpp
+++ b/lib/Support/TreeStream.cpp
@@ -63,7 +63,6 @@ TreeOStream TreeStreamWriter::open(const TreeOStream &os) {
 }
 
 void TreeStreamWriter::write(TreeOStream &os, const char *s, unsigned size) {
-#if 1
   if (bufferCount && 
       (os.id!=lastID || size+bufferCount>bufferSize))
     flushBuffer();
@@ -77,13 +76,8 @@ void TreeStreamWriter::write(TreeOStream &os, const char *s, unsigned size) {
   } else {
     output->write(reinterpret_cast<const char*>(&os.id), 4);
     output->write(reinterpret_cast<const char*>(&size), 4);
-    output->write(buffer, size);
+    output->write(s, size);
   }
-#else
-  output->write(reinterpret_cast<const char*>(&os.id), 4);
-  output->write(reinterpret_cast<const char*>(&size), 4);
-  output->write(s, size);
-#endif
 }
 
 void TreeStreamWriter::flushBuffer() {