Skip to Content.
Sympa Menu

charm - [charm] [PATCH] A printf-format bug fixed in Ck streams implementation.

charm AT lists.cs.illinois.edu

Subject: Charm++ parallel programming system

List archive

[charm] [PATCH] A printf-format bug fixed in Ck streams implementation.


Chronological Thread 
  • From: Artem Shvorin <shvorin AT gmail.com>
  • To: charm AT cs.uiuc.edu
  • Subject: [charm] [PATCH] A printf-format bug fixed in Ck streams implementation.
  • Date: Tue, 3 May 2011 18:17:18 +0400
  • List-archive: <http://lists.cs.uiuc.edu/pipermail/charm>
  • List-id: CHARM parallel programming system <charm.cs.uiuc.edu>

Hi!

There's a bug in Ck streams implementation: it's dangerous to output '%' symbol via those streams. For instance, “ckout << "%s" << endl;” may cause segfault.

I provide a trivial patch fixing the problem.

PS. I wonder if this mail list Is the right place to send reports/fixes. Is it OK to use “git format-patch” for creating patches?

---
 src/ck-core/ckstream.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ck-core/ckstream.h b/src/ck-core/ckstream.h
index b907893..04fed7c 100644
--- a/src/ck-core/ckstream.h
+++ b/src/ck-core/ckstream.h
@@ -35,9 +35,9 @@ class _CkOStream {
     _CkOStream& endl(void) {
       strcat(_obuf, "\n");
       if(_isErr)
-        CkError(_obuf);
+        CkError("%s", _obuf);
       else
-        CkPrintf(_obuf);
+        CkPrintf("%s", _obuf);
       _obuf[0] = '\0';
       _actlen=1;
       return *this;
--
1.5.6.5





Archive powered by MHonArc 2.6.16.

Top of Page