2010-05-31 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Mon, 31 May 2010 17:49:07 +0000 (17:49 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 31 May 2010 17:49:07 +0000 (17:49 -0000)
* unwind.c (mono_unwind_decode_fde): The FDE only has an augmention if the CIE
says so.

* aot-runtime.c (decode_eh_frame): Fix an assert condition.

svn path=/trunk/mono/; revision=158226

mono/mini/ChangeLog
mono/mini/aot-runtime.c
mono/mini/unwind.c

index 651f2fbf129a02de5000b28ef0824cadc6fddd1f..6eb2fb54649742275e1451a3c374c383bd23b590 100755 (executable)
@@ -1,5 +1,10 @@
 2010-05-31  Zoltan Varga  <vargaz@gmail.com>
 
+       * unwind.c (mono_unwind_decode_fde): The FDE only has an augmention if the CIE
+       says so.
+
+       * aot-runtime.c (decode_eh_frame): Fix an assert condition.
+
        * aot-compiler.c (patch_to_string): New debugging helper function.
 
 2010-05-30  Zoltan Varga  <vargaz@gmail.com>
index 789f9ce907d049e55d5e1aad8d4e8fafc7ed6955..cf2e59613a2f7bfa3988faadf8b969a8783ed037 100644 (file)
@@ -1570,7 +1570,7 @@ decode_eh_frame (MonoAotModule *amodule, MonoDomain *domain,
        }
 
        g_assert (code >= amodule->eh_frame_hdr + table [(pos * 2)]);
-       if (pos < fde_count)
+       if (pos + 1 < fde_count)
                g_assert (code < amodule->eh_frame_hdr + table [(pos * 2) + 2]);
 
        eh_frame = amodule->eh_frame_hdr + table [(pos * 2) + 1];
index 770e1661df3fde12b9a9976a12b8b790d89e75f9..1eee23b487f3e804323c4d7385b8eddf32bae887 100644 (file)
@@ -773,6 +773,7 @@ mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJi
        gint32 i, cie_aug_len, buf_len;
        char *cie_aug_str;
        guint8 *buf;
+       gboolean has_fde_augmentation = FALSE;
 
        /* 
         * http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html
@@ -810,6 +811,8 @@ mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJi
 
                g_assert (!strcmp (cie_aug_str, "zR") || !strcmp (cie_aug_str, "zPLR"));
 
+               has_fde_augmentation = TRUE;
+
                /* Check that the augmention is what we expect */
                if (!strcmp (cie_aug_str, "zPLR")) {
                        guint8 *cie_aug = p;
@@ -843,9 +846,13 @@ mono_unwind_decode_fde (guint8 *fde, guint32 *out_len, guint32 *code_len, MonoJi
        p += 4;
        pc_range = *(guint32*)p;
        p += 4;
-       aug_len = decode_uleb128 (p, &p);
-       fde_aug = p;
-       p += aug_len;
+       if (has_fde_augmentation) {
+               aug_len = decode_uleb128 (p, &p);
+               fde_aug = p;
+               p += aug_len;
+       } else {
+               aug_len = 0;
+       }
        fde_cfi = p;
        fde_data_len = fde + 4 + fde_len - p;