mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Only accept non-negative lyxscale parameters
Since lyxscale is unsigned, a negative value would lead to a very large positive value. Spotted by coverity.
This commit is contained in:
parent
50060053e3
commit
7d4b8b7606
@ -289,17 +289,23 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex)
|
||||
filename = buffer.getReferencedFileName(name);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
case EX_DISPLAY: {
|
||||
lex.next();
|
||||
display = lex.getString() != "false";
|
||||
break;
|
||||
}
|
||||
|
||||
case EX_LYXSCALE:
|
||||
case EX_LYXSCALE: {
|
||||
lex.next();
|
||||
lyxscale = lex.getInteger();
|
||||
int const ls = lex.getInteger();
|
||||
// negative values are not accepted.
|
||||
if (ls >= 0)
|
||||
lyxscale = ls;
|
||||
else
|
||||
lex.printError("ExternalInset::read: Wrong lyxscale: $$Token");
|
||||
break;
|
||||
}
|
||||
|
||||
case EX_DRAFT:
|
||||
draft = true;
|
||||
@ -379,8 +385,6 @@ bool InsetExternalParams::read(Buffer const & buffer, Lexer & lex)
|
||||
|
||||
if (lyxerr.debugging(Debug::EXTERNAL)) {
|
||||
lyxerr << "InsetExternalParams::read:\n";
|
||||
// false positive
|
||||
// coverity[NEGATIVE_RETURNS]
|
||||
write(buffer, lyxerr);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user