[packages/scm] - updated to 5f2 (slib 3b5) - updated texinfo patch - added bigrecy patch (fix bignum use-after-free

qboosh qboosh at pld-linux.org
Wed Jul 27 18:39:08 CEST 2016


commit 4445b0e8e5c5838c18372bd90e8ab99a984d2942
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Jul 27 18:39:38 2016 +0200

    - updated to 5f2 (slib 3b5)
    - updated texinfo patch
    - added bigrecy patch (fix bignum use-after-free issues introduced in 5f2)

 scm-bigrecy.patch |  92 ++++++++++++++++++++++++
 scm-texinfo.patch | 208 ------------------------------------------------------
 scm.spec          |  12 ++--
 3 files changed, 99 insertions(+), 213 deletions(-)
---
diff --git a/scm.spec b/scm.spec
index 8df8e32..cf61012 100644
--- a/scm.spec
+++ b/scm.spec
@@ -1,19 +1,20 @@
-%define	slib_ver	3b4
+%define	slib_ver	3b5
 Summary:	Scheme implementation
 Summary(pl.UTF-8):	Implementacja Scheme
 Name:		scm
-Version:	5f1
-Release:	3
+Version:	5f2
+Release:	1
 License:	LGPL v3+
 Group:		Development/Languages/Scheme
 Source0:	http://groups.csail.mit.edu/mac/ftpdir/scm/%{name}-%{version}.zip
-# Source0-md5:	98be8275f5c69d234c55a8a995a500dd
+# Source0-md5:	ff83b43844b4fc2efeaa102d8eed8a4a
 Source1:	http://groups.csail.mit.edu/mac/ftpdir/scm/slib-%{slib_ver}.tar.gz
-# Source1-md5:	dcada65c4df4209c8f71211095bcef8e
+# Source1-md5:	e4a218f81a5c905a64c333a0bbc79347
 Patch0:		%{name}-info.patch
 Patch1:		%{name}-install.patch
 Patch2:		%{name}-texinfo.patch
 Patch3:		x32.patch
+Patch4:		%{name}-bigrecy.patch
 URL:		http://people.csail.mit.edu/jaffer/SCM
 BuildRequires:	sed >= 4.0
 BuildRequires:	texinfo
@@ -36,6 +37,7 @@ IEEE P1178.
 %patch1 -p0
 %patch2 -p0
 %patch3 -p0
+%patch4 -p0
 
 ln -s slib-%{slib_ver} slib
 
diff --git a/scm-bigrecy.patch b/scm-bigrecy.patch
new file mode 100644
index 0000000..ac5c7a7
--- /dev/null
+++ b/scm-bigrecy.patch
@@ -0,0 +1,92 @@
+Fix (real or potential) bignum use-after-free issues.
+
+--- scm/scl.c.orig	2016-07-27 18:26:05.090046558 +0200
++++ scm/scl.c	2016-07-27 18:14:19.856721279 +0200
+@@ -166,33 +166,34 @@
+     /* try first with starved precision */
+     {
+       num = scm_ash(mant, MAKINUM(e2 - point));
+-      bigrecy(mant);
++      if (num != mant) bigrecy(mant);
+       quo = scm_round_quotient(num, VELTS(pows5)[(long) point]);
+       if (pmantexp2dbl(quo, point) != f) {
+-	bigrecy(quo); quo = num;
++	if (quo != num) { bigrecy(quo); quo = num; }
+ 	num = scm_ash(quo, MAKINUM(1L));
+-	bigrecy(quo);
++	if (num != quo) bigrecy(quo);
+ 	quo = scm_round_quotient(num, VELTS(pows5)[(long) --point]);
+       }
++      if (num != quo) bigrecy(num);
+     }
+   } else {   /* e2 <= 0 */
+     /* try first with starved precision */
+     {
+       SCM den = scm_ash(MAKINUM(1L), MAKINUM(point - e2));
+       num = product(mant, VELTS(pows5)[- (long) point]);
+-      bigrecy(mant);
++      if (num != mant) { bigrecy(mant); if (mant != MAKINUM(1)) mant = INUM0; }
+       quo = scm_round_quotient(num, den);
+       if (pmantexp2dbl(quo, point) != f) {
+-	bigrecy(quo); quo = num;
++	if (quo != num) { bigrecy(quo); quo = num; }
+ 	point--;
+ 	num = product(quo, MAKINUM(10));
+ 	if (mant != MAKINUM(1)) bigrecy(quo);
+ 	quo = scm_round_quotient(num, den);
+-      }
++	if (quo != num) bigrecy(num);
++      } else if ((mant != MAKINUM(1)) && (quo != num)) bigrecy(num);
+       bigrecy(den);
+     }
+   }
+-  bigrecy(num);
+   a[ch++] = '.';
+   /* if (sizeof(UBIGLONG)>=sizeof(double)) /\* Is ulong larger than mantissa? *\/ */
+   /*   ch += iulong2str(num2ulong(quo, (char *)ARG1, s_number2string), 10, &a[ch]); */
+@@ -680,7 +682,7 @@
+       ans = ldexp(ans, bex + point);
+     }
+     if (num != quo) bigrecy(quo);
+-    if (bmant != MAKINUM(1L)) bigrecy(num);
++    if ((num != bmant) && (bmant != MAKINUM(1L))) bigrecy(num);
+     return ans;
+   } else {
+     int maxpow = LENGTH(pows5) - 1;
+@@ -696,7 +697,7 @@
+       quo = scm_round_quotient(num, scm_ash(scl, MAKINUM(1L)));
+     }
+     if (-point > maxpow) bigrecy(scl);
+-    bigrecy(num);
++    if (num != quo) bigrecy(num);
+     ans = ldexp(int2dbl(quo), bex + point);
+     bigrecy(quo);
+     return ans;
+@@ -2478,7 +2479,7 @@
+ 	tmp = acc;
+ 	acc = product(tmp, tz1);
+ #ifdef BIGDIG
+-	bigrecy(tmp);
++	if (acc != tmp) bigrecy(tmp);
+ #endif
+ 	break;
+       }
+@@ -2486,7 +2487,7 @@
+ 	tmp = acc;
+ 	acc = product(tmp, tz1);
+ #ifdef BIGDIG
+-	bigrecy(tmp);
++	if (acc != tmp) bigrecy(tmp);
+ #endif
+       }
+       tmp = tz1;
+@@ -2841,8 +2842,8 @@
+       bex += j * BITSPERDIG;
+       if (bex > 0) ans = ldexp(ans, bex);
+     }
++    if (quo != num) bigrecy(quo);
+     if (num != b) bigrecy(num);
+-    if (quo != b) bigrecy(quo);
+     if (tc16_bigneg==TYP16(b)) return -ans;
+     return ans;
+   }
diff --git a/scm-texinfo.patch b/scm-texinfo.patch
index b459a18..621824b 100644
--- a/scm-texinfo.patch
+++ b/scm-texinfo.patch
@@ -1,211 +1,3 @@
---- scm/scm.texi.orig	2014-04-12 22:49:42.834513806 +0200
-+++ scm/scm.texi	2014-04-20 08:38:52.824504413 +0200
-@@ -1700,8 +1700,9 @@
- @defun getenv name
- Looks up @var{name}, a string, in the program environment.  If @var{name} is
- found a string of its value is returned.  Otherwise, @code{#f} is returned.
-+ at end defun
- 
-- at defunx getenv
-+ at defun getenv
- Returns names and values of all the environment variables as an
- association-list.
- 
-@@ -1726,8 +1727,9 @@
- The value of the environment variable @code{EDITOR} (or just @code{ed}
- if it isn't defined) is invoked as a command with arguments @var{arg1}
- @dots{}.
-+ at end defun
- 
-- at defunx ed filename
-+ at defun ed filename
- If SCM is compiled under VMS @code{ed} will invoke the editor with a
- single the single argument @var{filename}.
- @end defun
-@@ -1813,7 +1815,9 @@
- 
- @defmac trace proc1 @dots{}
- Traces the top-level named procedures given as arguments.
-- at defmacx trace
-+ at end defmac
-+
-+ at defmac trace
- With no arguments, makes sure that all the currently traced identifiers
- are traced (even if those identifiers have been redefined) and returns a
- list of the traced identifiers.
-@@ -1821,7 +1825,9 @@
- 
- @defmac untrace proc1 @dots{}
- Turns tracing off for its arguments.
-- at defmacx untrace
-+ at end defmac
-+
-+ at defmac untrace
- With no arguments, untraces all currently traced identifiers and returns
- a list of these formerly traced identifiers.
- @end defmac
-@@ -2284,8 +2290,9 @@
- Returns the path (string) which SCM uses to find the executable file
- whose invocation the currently running session is, or #f if the path is
- not set.
-+ at end defun
- 
-- at defunx execpath #f
-+ at defun execpath #f
- @defunx execpath newpath
- Sets the path to @code{#f} or @var{newpath}, respectively.  The old path
- is returned.
-@@ -2599,10 +2606,10 @@
- @itemx @code{exact->inexact}
- @itemx @code{inexact->exact}
- @xref{Numerical operations, , , r5rs, Revised(5) Scheme}.
-- at itemx @code{with-input-from-file}
-+ at item @code{with-input-from-file}
- @itemx @code{with-output-to-file}
- @xref{Ports, , , r5rs, Revised(5) Scheme}.
-- at itemx @code{load}
-+ at item @code{load}
- @itemx @code{transcript-on}
- @itemx @code{transcript-off}
- @xref{System interface, , , r5rs, Revised(5) Scheme}.
-@@ -3008,8 +3015,9 @@
- Returns the current position of the character in @var{port} which will
- next be read or written.  If @var{port} is open to a non-file then
- @code{#f} is returned.
-+ at end defun
- 
-- at defunx file-position port k
-+ at defun file-position port k
- Sets the current position in @var{port} which will next be read or
- written.  If successful, @code{#f} is returned.  If @var{port} is open
- to a non-file, then @code{file-position} returns @code{#f}.
-@@ -3399,8 +3407,9 @@
- @defun comment string1 @dots{}
- Appends @var{string1} @dots{} to the strings given as arguments to
- previous calls @code{comment}.
-+ at end defun
- 
-- at defunx comment
-+ at defun comment
- Returns the (appended) strings given as arguments to previous calls
- @code{comment} and empties the current string collection.
- @end defun
-@@ -3423,8 +3432,9 @@
- @code{#<unspecified>} in which case the expression will be treated as
- whitespace.  @code{#<unspecified>} is the value returned by the
- expression @code{(if #f #f)}.
-+ at end deffn
- 
-- at deffnx {Callback procedure} load:sharp c port
-+ at deffn {Callback procedure} load:sharp c port
- Dispatches like @code{read:sharp}, but only during @code{load}s.  The
- read-syntaxes handled by @code{load:sharp} are a superset of those
- handled by @code{read:sharp}.  @code{load:sharp} calls
-@@ -4818,12 +4828,14 @@
- each file in @var{directory}.  The dynamic order in which @var{proc} is
- applied to the filenames is unspecified.  The value returned by
- @samp{directory-for-each} is unspecified.
-+ at end defun
- 
-- at defunx directory-for-each proc directory pred
-+ at defun directory-for-each proc directory pred
- Applies @var{proc} only to those filenames for which the procedure
- @var{pred} returns a non-false value.
-+ at end defun
- 
-- at defunx directory-for-each proc directory match
-+ at defun directory-for-each proc directory match
- Applies @var{proc} only to those filenames for which
- @code{(filename:match?? @var{match})} would return a non-false value
- (@pxref{Filenames, , , slib, SLIB}).
-@@ -4959,8 +4971,9 @@
- 
- If successful, this procedure does not return.  Otherwise an error
- message is printed and the integer @code{errno} is returned.
-+ at end defun
- 
-- at defunx execv command arglist
-+ at defun execv command arglist
- @defunx execvp command arglist
- Like @code{execl} and @code{execlp} except that the set of arguments to
- @var{command} is @var{arglist}.
-@@ -5239,8 +5252,9 @@
- 
- @defun setpwent #t
- Rewinds the pw entry table back to the begining.
-+ at end defun
- 
-- at defunx setpwent #f
-+ at defun setpwent #f
- @defunx setpwent
- Closes the pw table.
- @end defun
-@@ -5267,8 +5281,9 @@
- 
- @defun setgrent #t
- Rewinds the group entry table back to the begining.
-+ at end defun
- 
-- at defunx setgrent #f
-+ at defun setgrent #f
- @defunx setgrent
- Closes the group table.
- @end defun
-@@ -5553,8 +5568,9 @@
- 
- @defun line-editing
- Returns the current edited line port or @code{#f}.
-+ at end defun
- 
-- at defunx line-editing bool
-+ at defun line-editing bool
- If @var{bool} is false, exits line-editing mode and returns the previous
- value of @code{(line-editing)}.  If @var{bool} is true, sets the current
- input and output ports to an edited line port and returns the previous
-@@ -6555,8 +6571,9 @@
- @code{letrec}, @code{or}, @code{quote}, @code{set!}, @code{#f},
- @code{#t}, @code{#<undefined>}, @code{#<eof>}, @code{()}, and
- @code{#<unspecified>}.
-+ at end deftp
- 
-- at deftpx {CAR Immediate} ispcsym
-+ at deftp {CAR Immediate} ispcsym
- special symbols: syntax-checked versions of first 14 isyms
- @end deftp
- 
-@@ -6682,8 +6699,9 @@
- 
- @deftp Header tc7_ssymbol
- static scheme symbol (part of initial system)
-+ at end deftp
- 
-- at deftpx Header tc7_msymbol
-+ at deftp Header tc7_msymbol
- @code{malloc}ed scheme symbol (can be GCed)
- 
- @defmac SYMBOLP x
-@@ -7754,8 +7772,9 @@
- @code{deferred_proc} is set to non-zero, one of the global variables
- @code{SIGINT_deferred} or @code{SIGALRM_deferred} is set to 1, and the
- handler returns.
-+ at end defmac
- 
-- at defmacx ALLOW_INTS
-+ at defmac ALLOW_INTS
- Checks the deferred variables and if set the appropriate handler is
- called.
- 
-@@ -8339,8 +8358,9 @@
- 
- @code{scm_addr} is useful for performing C operations on strings or
- other uniform arrays (@pxref{Uniform Array}).
-+ at end deftypefun
- 
-- at deftypefunx unsigned long scm_base_addr(SCM @var{ra}, char *@var{s_name})
-+ at deftypefun unsigned long scm_base_addr(SCM @var{ra}, char *@var{s_name})
- Returns a pointer (cast to an @code{unsigned long}) to the beginning
- of storage of array @var{ra}.  Note that if @var{ra} is a
- shared-array, the strorage accessed this way may be much larger than
 --- scm/Xlibscm.texi.orig	2014-04-20 09:17:36.657789313 +0200
 +++ scm/Xlibscm.texi	2014-04-20 09:44:30.514422341 +0200
 @@ -257,8 +257,9 @@
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/scm.git/commitdiff/4445b0e8e5c5838c18372bd90e8ab99a984d2942



More information about the pld-cvs-commit mailing list