mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix memory error detected by valgrind
The assignment name = sub.str(1) reads from the first argument given to regex_match(), but previously this was a temporary object which was already out of scope. This did probably not matter much in practice, but invoked undefined behaviour, and as we all know this is allowed ton format your hard disk or kill to your cat, so better fix this.
This commit is contained in:
parent
f146bded7a
commit
e5845fea49
@ -666,8 +666,8 @@ int LaTeX::scanLogFile(TeXErrors & terr)
|
||||
size_t len = j == string::npos
|
||||
? token.substr(i + 1).length()
|
||||
: j - i - 1;
|
||||
if (regex_match(token.substr(i + 1, len),
|
||||
sub, child_file)) {
|
||||
string const substr = token.substr(i + 1, len);
|
||||
if (regex_match(substr, sub, child_file)) {
|
||||
string const name = sub.str(1);
|
||||
child.push(make_pair(name, pnest));
|
||||
i += len;
|
||||
|
Loading…
Reference in New Issue
Block a user