OSDN Git Service

* config/sparc/sol2-unwind.h (sparc64_is_sighandler): Check that the
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jan 2012 18:21:52 +0000 (18:21 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 9 Jan 2012 18:21:52 +0000 (18:21 +0000)
purported sigacthandler address isn't null before dereferencing it.
(sparc_is_sighandler): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@183021 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/sparc/sol2-unwind.h

index ca61c0b..fd29612 100644 (file)
@@ -1,3 +1,9 @@
+2012-01-09  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * config/sparc/sol2-unwind.h (sparc64_is_sighandler): Check that the
+       purported sigacthandler address isn't null before dereferencing it.
+       (sparc_is_sighandler): Likewise.
+
 2012-01-09  Ramana Radhakrishnan  <ramana.radhakrishnan@linaro.org>
 
        Backport from mainline
index ae7a571..db10807 100644 (file)
@@ -124,10 +124,9 @@ sparc64_is_sighandler (unsigned int *pc, void *cfa, int *nframes)
          /* This matches the call_user_handler pattern for Solaris 10.
             There are 2 cases so we look for the return address of the
             caller's caller frame in order to do more pattern matching.  */
-         unsigned int sah_pattern
-           = *(unsigned int *)(*(unsigned long *)(cfa + 176 + 15*8) - 4);
+         unsigned long sah_address = *(unsigned long *)(cfa + 176 + 15*8);
 
-          if (sah_pattern == 0x92100019)
+          if (sah_address && *(unsigned int *)(sah_address - 4) == 0x92100019)
            /* This is the same setup as for Solaris 9, see below.  */
            *nframes = 3;
          else
@@ -293,10 +292,9 @@ sparc_is_sighandler (unsigned int *pc, void *cfa, int *nframes)
          /* This matches the call_user_handler pattern for Solaris 10.
             There are 2 cases so we look for the return address of the
             caller's caller frame in order to do more pattern matching.  */
-         unsigned int sah_pattern
-           = *(unsigned int *)(*(unsigned int *)(cfa + 96 + 15*4) - 4);
+         unsigned int sah_address = *(unsigned int *)(cfa + 96 + 15*4);
 
-          if (sah_pattern == 0x92100019)
+          if (sah_address && *(unsigned int *)(sah_address - 4) == 0x92100019)
            /* This is the same setup as for Solaris 9, see below.  */
            *nframes = 3;
          else