Fix for quote-escaping in smt2 printer
authorMorgan Deters <mdeters@cs.nyu.edu>
Sat, 18 Jan 2014 03:59:39 +0000 (22:59 -0500)
committerMorgan Deters <mdeters@cs.nyu.edu>
Sat, 18 Jan 2014 04:00:26 +0000 (23:00 -0500)
src/printer/smt2/smt2_printer.cpp

index b743ba70e695fc8812d7db33aae8bdbd2109c37a..4b36b454857ebece4a8d23270107f8911a3d1f84 100644 (file)
@@ -960,9 +960,10 @@ static void toStream(std::ostream& out, const CommandUnsupported* s) throw() {
 static void toStream(std::ostream& out, const CommandFailure* s) throw() {
   string message = s->getMessage();
   // escape all double-quotes
-  size_t pos;
-  while((pos = message.find('"')) != string::npos) {
+  size_t pos = 0;
+  while((pos = message.find('"', pos)) != string::npos) {
     message = message.replace(pos, 1, "\\\"");
+    pos += 2;
   }
   out << "(error \"" << message << "\")" << endl;
 }