[prev in list] [next in list] [prev in thread] [next in thread] 

List:       lyx-cvs
Subject:    [LyX/master] Limit the amount of derivatives in external CAS
From:       Jean-Marc Lasgouttes <lasgouttes () lyx ! org>
Date:       2017-03-28 9:19:58
Message-ID: 20170328091958.A02352800C0 () lyx ! lyx ! org
[Download RAW message or body]

commit bc7704a78e32e67253847fdd3d163005fa615209
Author: Jean-Marc Lasgouttes <lasgouttes@lyx.org>
Date:   Tue Mar 28 11:17:35 2017 +0200

    Limit the amount of derivatives in external CAS
    
    The (arbitrary) limit is 1000.
    
    Pointed out by coverity. A bad value could lock LyX.
---
 src/mathed/MathExtern.cpp |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/mathed/MathExtern.cpp b/src/mathed/MathExtern.cpp
index ee2004b..da43bd4 100644
--- a/src/mathed/MathExtern.cpp
+++ b/src/mathed/MathExtern.cpp
@@ -896,6 +896,10 @@ void extractDiff(MathData & ar)
 				int mult = 1;
 				if (extractNumber(script->up(), mult)) {
 					//lyxerr << "mult: " << mult << endl;
+					if (mult > 1000) {
+						lyxerr << "Cannot differentiate more than 1000 times !" << endl;
+						continue;
+					}
 					for (int i = 0; i < mult; ++i)
 						diff->addDer(MathData(buf, dt + 1, st));
 				}

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic