[pari] Fix crash in ellmul with obsolete use of E=[a1,a2,a3,a4,a6]

Paul Howarth pghmcfc at fedoraproject.org
Mon Jul 7 13:37:33 UTC 2014


commit d9cf81b82686d7a06d07d1f5cef67649832d5947
Author: Paul Howarth <paul at city-fan.org>
Date:   Mon Jul 7 14:30:58 2014 +0100

    Fix crash in ellmul with obsolete use of E=[a1,a2,a3,a4,a6]
    
    Upstream fix that will appear in pari 2.7.2
    (#1104802, upstream bug #1589).
    
    Note that the code triggering this bug is in an obsolete form
    that will report an error in pari 2.8.

 pari-2.7.1-bz1104802.patch |  116 ++++++++++++++++++++++++++++++++++++++++++++
 pari.spec                  |   12 ++++-
 2 files changed, 127 insertions(+), 1 deletions(-)
---
diff --git a/pari-2.7.1-bz1104802.patch b/pari-2.7.1-bz1104802.patch
new file mode 100644
index 0000000..cd00def
--- /dev/null
+++ b/pari-2.7.1-bz1104802.patch
@@ -0,0 +1,116 @@
+From ea2c3799d691fb82082661cb1e71bf2f0997c99d Mon Sep 17 00:00:00 2001
+From: Karim Belabas <Karim.Belabas at math.u-bordeaux1.fr>
+Date: Thu, 26 Jun 2014 15:55:17 +0200
+Subject: [PATCH] BA  9- obsolete use of E=[a1,a2,a3,a4,a6] in ellmul crashed 
+              [F33]
+
+---
+ CHANGES                 |    1 +
+ doc/usersch7.tex        |    4 ++--
+ src/basemath/elliptic.c |    5 +++--
+ src/test/32/ell         |    3 ++-
+ src/test/64/ell         |    3 ++-
+ src/test/in/ell         |    1 +
+ 6 files changed, 11 insertions(+), 6 deletions(-)
+
+#diff --git a/CHANGES b/CHANGES
+#index 54d6ef1..a606481 100644
+#--- a/CHANGES
+#+++ b/CHANGES
+#@@ -16,6 +16,7 @@ Done for version 2.7.2 (released ??/??/2014):
+#     6- factor((3+4*I)/25) -> factor 2+I had 0 exponent [#1586]            [F29]
+# BA  7- iferr() could crash if some component of the t_ERROR were clones.  [F31]
+#     8- nffactor() could overflow the stack when default accuracy too low  [F32]
+#+BA  9- obsolete use of E=[a1,a2,a3,a4,a6] in ellmul crashed  [#1589]      [F33]
+# 
+# Done for version 2.7.1 (released 16/05/2014):
+# [last column crossreferences current development release 2.8.0]
+diff --git a/doc/usersch7.tex b/doc/usersch7.tex
+index ccdee48..534cc45 100644
+--- a/doc/usersch7.tex
++++ b/doc/usersch7.tex
+@@ -46,8 +46,8 @@ or a \typ{STR} in Cremona's notation, e.g. \kbd{"11a1"}. The optional $D$
+ 
+ \fun{void}{checkell}{GEN e} raise an error unless $e$ is a \var{ell}.
+ 
+-\fun{void}{checkell5}{GEN e} raise an error unless $e$ is an \var{ell},
+-a \var{smallell} or an \var{ell5}.
++\fun{void}{checkell5}{GEN e} raise an error unless $e$ is an \var{ell}
++or an \var{ell5}.
+ 
+ \fun{void}{checkellpt}{GEN z} raise an error unless $z$ is a point
+ (either finite or at infinity).
+diff --git a/src/basemath/elliptic.c b/src/basemath/elliptic.c
+index 4b9000f..c68f47f 100644
+--- a/src/basemath/elliptic.c
++++ b/src/basemath/elliptic.c
+@@ -1419,7 +1419,7 @@ ellmul_Z(GEN e, GEN z, GEN n)
+ {
+   long s;
+   if (ell_is_inf(z)) return ellinf();
+-  if (ell_over_Fq(e)) return ellffmul(e,z,n);
++  if (lg(e)==17 && ell_over_Fq(e)) return ellffmul(e,z,n);
+   s = signe(n);
+   if (!s) return ellinf();
+   if (s < 0) z = ellneg_i(e,z);
+@@ -1510,7 +1510,8 @@ static GEN
+ ellmul_CM_aux(GEN e, GEN z, GEN a, GEN w)
+ {
+   GEN A, B, q;
+-  if (typ(a) != t_INT) pari_err_TYPE("ellmul_Z",a);
++  checkell(e);
++  if (typ(a) != t_INT) pari_err_TYPE("ellmul_CM",a);
+   q = CM_factor(e, w);
+   if (!q) pari_err_TYPE("ellmul [not a complex multiplication]",w);
+   if (q != gen_1) w = gdiv(w, q);
+diff --git a/src/test/32/ell b/src/test/32/ell
+index c931b0a..c30ee18 100644
+--- a/src/test/32/ell
++++ b/src/test/32/ell
+@@ -338,6 +338,7 @@ small([1]), [Vecsmall([128, -1])], [0, 0, 0, 0, 0, 0, 0, [[2, 3]~, [1/2, 0,
+ 1
+ [6.2500000000000000000000000000000000000, -140.62500000000000000000000000000
+ 000000]
++[37247908142/10128208321, 7601802384416381/1019292757217119]
+ [0, 0, 0, x^2, x, 0, 2*x^2, 4*x, -x^4, -48*x^2, -864*x, -64*x^6 - 432*x^2, -
+ 6912*x^4/(-4*x^4 - 27), Vecsmall([0]), [Vecsmall([128, 0])], [0, 0, 0, 0]]
+   ***   at top-level: ellminimalmodel(E)
+@@ -394,4 +395,4 @@ Mod(1, 1009)*x + Mod(185, 1009)*x^5 + Mod(101, 1009)*x^9 + Mod(990, 1009)*x^
+ 13 + O(x^17)
+ -52760
+ -52832
+-Total time spent: 1608
++Total time spent: 1052
+diff --git a/src/test/64/ell b/src/test/64/ell
+index e83df14..d8f5797 100644
+--- a/src/test/64/ell
++++ b/src/test/64/ell
+@@ -345,6 +345,7 @@ small([1]), [Vecsmall([128, -1])], [0, 0, 0, 0, 0, 0, 0, [[2, 3]~, [1/2, 0,
+ 0
+ [6.2500000000000000000000000000000000000, -140.62500000000000000000000000000
+ 000000]
++[37247908142/10128208321, 7601802384416381/1019292757217119]
+ [0, 0, 0, x^2, x, 0, 2*x^2, 4*x, -x^4, -48*x^2, -864*x, -64*x^6 - 432*x^2, -
+ 6912*x^4/(-4*x^4 - 27), Vecsmall([0]), [Vecsmall([128, 0])], [0, 0, 0, 0]]
+   ***   at top-level: ellminimalmodel(E)
+@@ -401,4 +402,4 @@ Mod(1, 1009)*x + Mod(185, 1009)*x^5 + Mod(101, 1009)*x^9 + Mod(990, 1009)*x^
+ 13 + O(x^17)
+ -52760
+ -52832
+-Total time spent: 640
++Total time spent: 568
+diff --git a/src/test/in/ell b/src/test/in/ell
+index c180ee0..31e13b1 100644
+--- a/src/test/in/ell
++++ b/src/test/in/ell
+@@ -234,6 +234,7 @@ elllocalred(E,5)
+ ellisoncurve(E,[0.,125.])
+ ellisoncurve(E,[0.,125+1e-50])
+ elladd(E,[0.,125.],[0.,125+1e-38])
++iferr(ellmul([0,1,0,2,-15],[2,1],5),E,E)
+ x='x;
+ E=ellinit([x^2,x])
+ ellminimalmodel(E)
+-- 
+1.7.10.4
+
diff --git a/pari.spec b/pari.spec
index 437b6cf..bf4e913 100644
--- a/pari.spec
+++ b/pari.spec
@@ -1,6 +1,6 @@
 Name:           pari
 Version:        2.7.1
-Release:        3%{?dist}
+Release:        4%{?dist}
 Summary:        Number Theory-oriented Computer Algebra System
 Group:          System Environment/Libraries
 # No version is specified
@@ -10,6 +10,7 @@ Source0:        http://pari.math.u-bordeaux.fr/pub/pari/unix/pari-%{version}.tar
 Source1:        gp.desktop
 Patch0:         pari-2.5.1-xdgopen.patch
 Patch1:         pari-2.7.0-optflags.patch
+Patch2:         pari-2.7.1-bz1104802.patch
 Patch10:        pari-2.7.0-missing-field-init.patch
 Patch11:        pari-2.7.0-declaration-not-prototype.patch
 Patch12:        pari-2.7.1-clobbered.patch
@@ -75,6 +76,11 @@ contains a wealth of number-theoretic functions.
 %patch1
 sed -i -e 's|@OPTFLAGS@|%{optflags} -Wall -Wextra -Wstrict-prototypes|' config/get_cc
 
+# Fix crash in ellmul
+# http://bugzilla.redhat.com/1104802
+# http://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=1589
+%patch2 -p1
+
 # Fix compiler warnings
 # http://pari.math.u-bordeaux.fr/cgi-bin/bugreport.cgi?bug=1316
 %patch10
@@ -165,6 +171,10 @@ make test-all
 %{_libdir}/libpari.so
 
 %changelog
+* Mon Jul  7 2014 Paul Howarth <paul at city-fan.org> - 2.7.1-4
+- Fix crash in ellmul with obsolete use of E=[a1,a2,a3,a4,a6]
+  (#1104802, upstream bug #1589)
+
 * Fri Jun 06 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.7.1-3
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
 


More information about the scm-commits mailing list