From dd60e2ff9647408b04f1247bb81c3545dd23d1a6 Mon Sep 17 00:00:00 2001 From: weidai Date: Thu, 18 Jun 2009 20:08:16 +0000 Subject: [PATCH] fix bug in PutDecodedDatumInto() with STLPort (from trungantran) --- datatest.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datatest.cpp b/datatest.cpp index 04b4e72b..b7b73da8 100644 --- a/datatest.cpp +++ b/datatest.cpp @@ -64,7 +64,11 @@ void PutDecodedDatumInto(const TestData &data, const char *name, BufferedTransfo while (!s1.empty()) { while (s1[0] == ' ') + { s1 = s1.substr(1); + if (s1.empty()) + return; //avoid invalid read if s1 is empty + } int repeat = 1; if (s1[0] == 'r')