Fix crash when importing cmake tests whose arguments contain ')'
In projectmanagers/cmake/cmakeimportjsonjob.cpp, there's a regular expression that matches 'add_test' lines from CTestTestfile.cmake files, but it stops reading at the first ) character: `const QRegularExpression rx("add_test *\\((.+?) (.*?)\\)");` If the argument list for the add_test line contains brackets, for instance: add_test(some-test "/some/path" "(foo)" "bar") ...then this causes a segfault a few lines further down - the second rx capture is not a well-formed argument list. This patch changes the regexp to only stop when ) is at the end of the line: `const QRegularExpression rx("add_test *\\((.+?) (.*?)\\) *$");` It also allows for spaces between the ')' and the end of the line, to be consistent with allowing extra spacing earlier on after add_test. I'm not sure if this matters in practice but is harmless enough. REVIEW: 126931 BUG: 358454 From f45971369c78cc88b03a9b11067fa28f65b84ce2 Mon Sep 17 00:00:00 2001 From: Andrew Coles <andrew.i.coles@googlemail.com> Date: Wed, 3 Feb 2016 10:52:18 +0000 Subject: [PATCH] Bug fix, and unit test - no longer crash if test arguments contain parentheses
parent
3bb1636e
Please register or sign in to comment