Le 10/03/2017 à 10:35, Jean-Marc Lasgouttes a écrit :
commit e2f2915f8edcc558e7d41b6e9bf8e0a6838ba47d
Author: Jean-Marc Lasgouttes <lasgout...@lyx.org>
Date: Fri Mar 10 10:32:38 2017 +0100
Be careful about unparsable bibtex years
Handle gracefully the case where the regex that parses a year fails.
This is a fixup to ba171930 (spotted by coverity).
Jürgen, please check that I did the right thing.
JMarc
---
src/BiblioInfo.cpp | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/src/BiblioInfo.cpp b/src/BiblioInfo.cpp
index 5e2c7db..bfde294 100644
--- a/src/BiblioInfo.cpp
+++ b/src/BiblioInfo.cpp
@@ -417,7 +417,9 @@ docstring const BibTeXInfo::getYear() const
static regex const ereg(".*/[-]?([\\d]{4}).*");
smatch sm;
string const date = to_utf8(year);
- regex_match(date, sm, yreg);
+ if (!regex_match(date, sm, yreg))
+ // cannot parse year.
+ return docstring();
year = from_ascii(sm[1]);
// check for an endyear
if (regex_match(date, sm, ereg))