This commit is contained in:
parent
a1e3d14dcf
commit
761141915e
@ -1,84 +0,0 @@
|
||||
parent f01d2b07a7a668e6b27b9527e070d8315c084d6e ()
|
||||
commit 9316710832a9f6d582e1dcf3b9645e9efc8efc8f
|
||||
Author: Jan Engelhardt <jengelh@medozas.de>
|
||||
Date: Sun Jun 26 11:42:56 2011 +0200
|
||||
|
||||
src: fix undefined behavior in copy operations
|
||||
---
|
||||
src/gap.c | 4 ++--
|
||||
src/saveload.c | 6 ++++--
|
||||
src/streams.c | 4 ++--
|
||||
3 files changed, 8 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/src/gap.c b/src/gap.c
|
||||
index 06fc308..a95b1d5 100644
|
||||
--- a/src/gap.c
|
||||
+++ b/src/gap.c
|
||||
@@ -1891,7 +1891,7 @@ Obj FuncCOM_FILE (
|
||||
Pr( "#I READ_GAP_ROOT: loading '%s' dynamically\n",
|
||||
(Int)CSTR_STRING(filename), 0L );
|
||||
}
|
||||
- info = *(StructInitInfo**)result;
|
||||
+ memcpy(&info, result, sizeof(info));
|
||||
res = info->initKernel(info);
|
||||
UpdateCopyFopyInfo();
|
||||
res = res || info->initLibrary(info);
|
||||
@@ -1909,7 +1909,7 @@ Obj FuncCOM_FILE (
|
||||
Pr( "#I READ_GAP_ROOT: loading '%s' statically\n",
|
||||
(Int)CSTR_STRING(filename), 0L );
|
||||
}
|
||||
- info = *(StructInitInfo**)result;
|
||||
+ memcpy(&info, result, sizeof(info));
|
||||
res = info->initKernel(info);
|
||||
UpdateCopyFopyInfo();
|
||||
res = res || info->initLibrary(info);
|
||||
diff --git a/src/saveload.c b/src/saveload.c
|
||||
index 52dc82d..2e2d55a 100644
|
||||
--- a/src/saveload.c
|
||||
+++ b/src/saveload.c
|
||||
@@ -452,7 +452,7 @@ void SaveDouble( Double d)
|
||||
{
|
||||
UInt i;
|
||||
UInt1 buf[sizeof(Double)];
|
||||
- *(Double *)buf = d;
|
||||
+ memcpy(buf, &d, sizeof(d));
|
||||
for (i = 0; i < sizeof(Double); i++)
|
||||
SAVE_BYTE(buf[i]);
|
||||
}
|
||||
@@ -461,9 +461,11 @@ Double LoadDouble( void)
|
||||
{
|
||||
UInt i;
|
||||
UInt1 buf[sizeof(Double)];
|
||||
+ Double d;
|
||||
for (i = 0; i < sizeof(Double); i++)
|
||||
buf[i] = LOAD_BYTE();
|
||||
- return *(Double *)buf;
|
||||
+ memcpy(&d, buf, sizeof(d));
|
||||
+ return d;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
diff --git a/src/streams.c b/src/streams.c
|
||||
index e91cd92..3091fb9 100644
|
||||
--- a/src/streams.c
|
||||
+++ b/src/streams.c
|
||||
@@ -353,7 +353,7 @@ Int READ_GAP_ROOT ( Char * filename )
|
||||
Pr( "#I READ_GAP_ROOT: loading '%s' dynamically\n",
|
||||
(Int)filename, 0L );
|
||||
}
|
||||
- info = *(StructInitInfo**)result;
|
||||
+ memcpy(&info, result, sizeof(info));
|
||||
res = info->initKernel(info);
|
||||
if (!SyRestoring) {
|
||||
UpdateCopyFopyInfo();
|
||||
@@ -374,7 +374,7 @@ Int READ_GAP_ROOT ( Char * filename )
|
||||
Pr( "#I READ_GAP_ROOT: loading '%s' statically\n",
|
||||
(Int)filename, 0L );
|
||||
}
|
||||
- info = *(StructInitInfo**)result;
|
||||
+ memcpy(&info, result, sizeof(info));
|
||||
res = info->initKernel(info);
|
||||
if (!SyRestoring) {
|
||||
UpdateCopyFopyInfo();
|
||||
--
|
||||
# Created with git-export-patch
|
3
gap.spec
3
gap.spec
@ -25,7 +25,8 @@ Group: Productivity/Scientific/Math
|
||||
Url: http://gap-system.org/
|
||||
|
||||
Source: https://www.gap-system.org/pub/gap/gap4core/gap4r8p8_nopackages.zip
|
||||
Source2: %name-rpmlintrc
|
||||
Source2: macros.gap
|
||||
Source3: %name-rpmlintrc
|
||||
Patch1: gap-final-dir.diff
|
||||
Patch2: gap-multiarch.diff
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
|
Loading…
x
Reference in New Issue
Block a user