[Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG
Julien Nabet
serval2412 at yahoo.fr
Wed Jun 29 14:26:45 PDT 2011
Le 29/06/2011 08:44, Julien Nabet a écrit :
> Hello,
>
> I tried the patch attached. In fact, I remarked by reading some forums
> (sorry i don't remember the specific link I read) that getline could
> need some extra precaution. I don't know if this patch is correct but
> there's no more memory error. However there's now an assertion failure
> because number of env vars is different from number children env vars.
Sorry, in my previous message the call of the function "ignore" was
hiding the problem.
However I found that if I apply this patch, it works :
diff --git a/sal/qa/osl/process/osl_process.cxx
b/sal/qa/osl/process/osl_process.cxx
index 2535c4c..8695d79 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -477,6 +477,7 @@ public:
);
std::string line;
+ line.reserve(10000);
while (std::getline(file, line, '\0'))
env_container->push_back(line);
tidy_container(*env_container);
(I haven't search about adjusting reserve)
Julien.
More information about the LibreOffice
mailing list