]> www.ginac.de Git - ginac.git/commitdiff
Fix out-of-bounds error in multivar_diophant().
authorRichard Kreckel <kreckel@ginac.de>
Wed, 31 Jan 2018 21:55:02 +0000 (22:55 +0100)
committerRichard Kreckel <kreckel@ginac.de>
Wed, 31 Jan 2018 21:55:02 +0000 (22:55 +0100)
This could trigger an assertion in the factorization exams introduced
in afb0ccaa49 if the library was compiled with -DDO_GINAC_ASSERT.

ginac/factor.cpp

index 12e81a8d55cc5bc5603d0df39a6f3c8d11f7ab33..aac6038ab932ccb53bd603652dd646d37833de1b 100644 (file)
@@ -1953,7 +1953,7 @@ static vector<ex> multivar_diophant(const vector<ex>& a_, const ex& x, const ex&
                                delta_s[j] = delta_s[j] * modcm;
                                sigma[j] = sigma[j] + umodpoly_to_ex(delta_s[j], x);
                        }
-                       if ( nterms > 1 ) {
+                       if ( nterms > 1 && i+1 != nterms ) {
                                z = c.op(i+1);
                        }
                }