probleme out-of-bounds string/array access sur Mac OS 10.2

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@5141 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Damien Doligez 2002-09-23 18:03:56 +00:00
parent 0bacf85473
commit 7f968224ae
3 changed files with 29 additions and 11 deletions

View File

@ -15,9 +15,12 @@
#include <signal.h>
#include <stdio.h>
#if (defined(TARGET_sparc) && defined(SYS_solaris))
#if defined(TARGET_sparc) && defined(SYS_solaris)
#include <ucontext.h>
#endif
#if defined(TARGET_power) && defined(SYS_rhapsody) && defined(DARWIN_VERSION_6)
#include <sys/ucontext.h>
#endif
#include "alloc.h"
#include "callback.h"
#include "memory.h"
@ -39,10 +42,23 @@ extern sighandler win32_signal(int sig, sighandler action);
#endif
#if defined(TARGET_power) && defined(SYS_rhapsody)
/* Confer machdep/ppc/unix_signal.c and mach/ppc/thread_status.h
in the Darwin sources */
#define CONTEXT_GPR(ctx, regno) \
(((unsigned long *)((ctx)->sc_regs))[2 + (regno)])
#ifdef DARWIN_VERSION_6
/* cf. xnu/osfmk/dev/ppc/unix_signal.c
xnu/osfmk/mach/ppc/thread_status.h
xnu/bsd/sys/ucontext.h
xnu/bsd/ppc/signal.h
etc. etc. etc.
*/
#define STRUCT_SIGCONTEXT struct ucontext
#define CONTEXT_GPR(ctx, regno) \
(((unsigned long *)&((ctx)->uc_mcontext->ss))[2 + (regno)])
#else
/* Confer machdep/ppc/unix_signal.c and mach/ppc/thread_status.h
in the Darwin sources */
#define STRUCT_SIGCONTEXT struct sigcontext
#define CONTEXT_GPR(ctx, regno) \
(((unsigned long *)((ctx)->sc_regs))[2 + (regno)])
#endif
#endif
#if defined(TARGET_power) && defined(SYS_aix)
@ -161,7 +177,7 @@ void handle_signal(int sig, int code, STRUCT_SIGCONTEXT * context)
#elif defined(TARGET_power) && defined(SYS_elf)
void handle_signal(int sig, struct sigcontext * context)
#elif defined(TARGET_power) && defined(SYS_rhapsody)
void handle_signal(int sig, int code, struct sigcontext * context)
void handle_signal(int sig, int code, STRUCT_SIGCONTEXT * context)
#else
void handle_signal(int sig)
#endif
@ -429,7 +445,7 @@ static void trap_handler(int sig, struct sigcontext * context)
#endif
#if defined(TARGET_power) && defined(SYS_rhapsody)
static void trap_handler(int sig, int code, struct sigcontext * context)
static void trap_handler(int sig, int code, STRUCT_SIGCONTEXT * context)
{
/* Unblock SIGTRAP */
sigset_t mask;
@ -523,7 +539,11 @@ void init_signals(void)
act.sa_handler = (void (*)(int)) trap_handler;
sigemptyset(&act.sa_mask);
#if defined(SYS_rhapsody) || defined(SYS_aix)
#ifdef DARWIN_VERSION_6
act.sa_flags = SA_SIGINFO;
#else
act.sa_flags = 0;
#endif
#else
act.sa_flags = SA_NODEFER;
#endif

4
configure vendored
View File

@ -558,10 +558,8 @@ case "$arch,$nativecc,$system,$host_type" in
nativecccompopts="-D_XOPEN_SOURCE=500";;
*,*,nextstep,*) nativecccompopts="$gcc_warnings -U__GNUC__ -posix"
nativecclinkopts="-posix";;
# SHRINKED_GNUC is not necessary for MacOS 10.1 (don't know about 10.0)
# (but it doesn't matter for native code anyway)
*,*,rhapsody,*darwin6*) nativecccompopts="$gcc_warnings -DDARWIN_VERSION_6";;
*,*,rhapsody,*) nativecccompopts="$gcc_warnings -DSHRINKED_GNUC";;
# *,*,rhapsody,*) nativecccompopts="$gcc_warnings";;
*,gcc*,cygwin,*) nativecccompopts="$gcc_warnings -U_WIN32";;
*,gcc*,*,*) nativecccompopts="$gcc_warnings";;
esac

View File

@ -78,4 +78,4 @@ let catch_break on =
(* OCaml version string, moved from utils/config.mlp.
Must be in the format described in sys.mli. *)
let ocaml_version = "3.06+3 (2002-09-18)"
let ocaml_version = "3.06+4 (2002-09-23)"