aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-06-24 20:46:46 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-06-26 11:53:57 +0300
commit360ee295a8c5ac1f693e38160302c1ea93bb9964 (patch)
tree1d545f9313a501f917bc2ed51f462b2eee2f362a
parentafe67a4a67647e7f72af63bd9c978445113d0b4f (diff)
Only examine first 512 log line bytes for warnings detection
Fixes
-rw-r--r--bbot/worker.cxx8
-rw-r--r--doc/manual.cli2
2 files changed, 8 insertions, 2 deletions
diff --git a/bbot/worker.cxx b/bbot/worker.cxx
index a0e2ad7..81d9a50 100644
--- a/bbot/worker.cxx
+++ b/bbot/worker.cxx
@@ -116,7 +116,13 @@ run_bpkg (tracer& t,
{
for (const auto& re: warn_detect)
{
- if (regex_search (l, re))
+ // Only examine the first 512 bytes. Long lines (e.g., linker
+ // command lines) could trigger implementation-specific limitations
+ // (like stack overflow). Plus, it is a performance concern.
+ //
+ if (regex_search (l.begin (),
+ l.size () < 512 ? l.end () : l.begin () + 512,
+ re))
{
r = result_status::warning;
break;
diff --git a/doc/manual.cli b/doc/manual.cli
index 8e0d745..d196b30 100644
--- a/doc/manual.cli
+++ b/doc/manual.cli
@@ -334,7 +334,7 @@ build configuration to use for building the package.
\li|\n\c{warning-regex: <warning-regexes>}\n
Additional regular expressions that should be used to detect warnings in
- the logs.
+ the logs. Note that only the first 512 bytes of each log line is considered.
A single level of quotes (either single or double) is removed in each
expression before being used for search. For example, the following value: