Accepting request 108217 from home:k0da:ppc
- The perl 5.12 packages are compiled with -Duse64bitint, which means that IVs are 64-bits even on 32-bit architectures. When converting IVs, SWIG assumes that an IV is the same size as a long, which causes OverflowErrors with unsigned longs when the value is greater than 2^31. OBS-URL: https://build.opensuse.org/request/show/108217 OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/swig?expand=0&rev=31
This commit is contained in:
parent
d61fa65c83
commit
e65876f8c1
80
swig-2.0.4-fix-overflow-error-64bitint.patch
Normal file
80
swig-2.0.4-fix-overflow-error-64bitint.patch
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
Description: Fix overflow errors with 64-bit IVs
|
||||||
|
The perl 5.12 packages are compiled with -Duse64bitint, which means that IVs
|
||||||
|
are 64-bits even on 32-bit architectures. When converting IVs, SWIG assumes
|
||||||
|
that an IV is the same size as a long, which causes OverflowErrors with
|
||||||
|
unsigned longs when the value is greater than 2^31.
|
||||||
|
.
|
||||||
|
This patch should remove those assumptions by using the "IV" type defined by
|
||||||
|
the perl headers, and explicitly checking the values are within the correct
|
||||||
|
range for the type being converted.
|
||||||
|
Author: Chris Butler <chrisb@debian.org>
|
||||||
|
Bug-Debian: http://bugs.debian.org/579540
|
||||||
|
Forwarded: no
|
||||||
|
|
||||||
|
--- a/Lib/perl5/perlprimtypes.swg
|
||||||
|
+++ b/Lib/perl5/perlprimtypes.swg
|
||||||
|
@@ -56,8 +56,13 @@
|
||||||
|
SWIG_AsVal_dec(long)(SV *obj, long* val)
|
||||||
|
{
|
||||||
|
if (SvIOK(obj)) {
|
||||||
|
- if (val) *val = SvIV(obj);
|
||||||
|
- return SWIG_OK;
|
||||||
|
+ IV v = SvIV(obj);
|
||||||
|
+ if (v >= LONG_MIN && v <= LONG_MAX) {
|
||||||
|
+ if (val) *val = v;
|
||||||
|
+ return SWIG_OK;
|
||||||
|
+ } else {
|
||||||
|
+ return SWIG_OverflowError;
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
int dispatch = 0;
|
||||||
|
const char *nptr = SvPV_nolen(obj);
|
||||||
|
@@ -108,11 +113,16 @@
|
||||||
|
SWIG_AsVal_dec(unsigned long)(SV *obj, unsigned long *val)
|
||||||
|
{
|
||||||
|
if (SvUOK(obj)) {
|
||||||
|
- if (val) *val = SvUV(obj);
|
||||||
|
- return SWIG_OK;
|
||||||
|
+ UV v = SvUV(obj);
|
||||||
|
+ if (v >= 0 && v <= ULONG_MAX) {
|
||||||
|
+ if (val) *val = v;
|
||||||
|
+ return SWIG_OK;
|
||||||
|
+ } else {
|
||||||
|
+ return SWIG_OverflowError;
|
||||||
|
+ }
|
||||||
|
} else if (SvIOK(obj)) {
|
||||||
|
- long v = SvIV(obj);
|
||||||
|
- if (v >= 0) {
|
||||||
|
+ IV v = SvIV(obj);
|
||||||
|
+ if (v >= 0 && v <= ULONG_MAX) {
|
||||||
|
if (val) *val = v;
|
||||||
|
return SWIG_OK;
|
||||||
|
} else {
|
||||||
|
@@ -179,8 +189,13 @@
|
||||||
|
SWIG_AsVal_dec(long long)(SV *obj, long long *val)
|
||||||
|
{
|
||||||
|
if (SvIOK(obj)) {
|
||||||
|
- if (val) *val = SvIV(obj);
|
||||||
|
- return SWIG_OK;
|
||||||
|
+ IV v = SvIV(obj);
|
||||||
|
+ if (v >= LLONG_MIN && v <= LLONG_MAX) {
|
||||||
|
+ if (val) *val = v;
|
||||||
|
+ return SWIG_OK;
|
||||||
|
+ } else {
|
||||||
|
+ return SWIG_OverflowError;
|
||||||
|
+ }
|
||||||
|
} else {
|
||||||
|
int dispatch = 0;
|
||||||
|
const char *nptr = SvPV_nolen(obj);
|
||||||
|
@@ -246,8 +261,8 @@
|
||||||
|
if (val) *val = SvUV(obj);
|
||||||
|
return SWIG_OK;
|
||||||
|
} else if (SvIOK(obj)) {
|
||||||
|
- long v = SvIV(obj);
|
||||||
|
- if (v >= 0) {
|
||||||
|
+ IV v = SvIV(obj);
|
||||||
|
+ if (v >= 0 && v <= ULLONG_MAX) {
|
||||||
|
if (val) *val = v;
|
||||||
|
return SWIG_OK;
|
||||||
|
} else {
|
||||||
|
|
@ -1,3 +1,12 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Mar 6 19:24:07 UTC 2012 - dvaleev@suse.com
|
||||||
|
|
||||||
|
- The perl 5.12 packages are compiled with -Duse64bitint, which
|
||||||
|
means that IVs are 64-bits even on 32-bit architectures. When
|
||||||
|
converting IVs, SWIG assumes that an IV is the same size as a
|
||||||
|
long, which causes OverflowErrors with unsigned longs when
|
||||||
|
the value is greater than 2^31.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Mar 6 09:15:47 UTC 2012 - kkaempf@suse.com
|
Tue Mar 6 09:15:47 UTC 2012 - kkaempf@suse.com
|
||||||
|
|
||||||
|
@ -67,6 +67,7 @@ Patch3: swig-2.0.4-disable-broken-tests.patch
|
|||||||
Patch4: swig-2.0.4-disable-broken-tests_rhel4.patch
|
Patch4: swig-2.0.4-disable-broken-tests_rhel4.patch
|
||||||
# PATCH-FIX-UPSTREAM swig-2.0.4-guile2.patch pgajdos@suse.com -- generate guile 2 friendly code
|
# PATCH-FIX-UPSTREAM swig-2.0.4-guile2.patch pgajdos@suse.com -- generate guile 2 friendly code
|
||||||
Patch5: swig-2.0.4-guile2.patch
|
Patch5: swig-2.0.4-guile2.patch
|
||||||
|
Patch6: swig-2.0.4-fix-overflow-error-64bitint.patch
|
||||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||||
|
|
||||||
%description
|
%description
|
||||||
@ -131,6 +132,7 @@ understandig SWIG usage.
|
|||||||
%if 0%{?suse_version} >= 1210
|
%if 0%{?suse_version} >= 1210
|
||||||
%patch5 -p1
|
%patch5 -p1
|
||||||
%endif
|
%endif
|
||||||
|
%patch6 -p1
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --disable-ccache
|
%configure --disable-ccache
|
||||||
|
Loading…
Reference in New Issue
Block a user