Merge commit '5b7632331e7551ac202bbaba37c572b96a791c6e'
[bpt/guile.git] / libguile / loader.c
index 83c5bb5..a55bd15 100644 (file)
@@ -392,8 +392,12 @@ load_thunk_from_memory (char *data, size_t len, int is_read_only)
           if (dynamic_segment >= 0)
             ABORT ("expected only one PT_DYNAMIC segment");
           dynamic_segment = i;
+          continue;
         }
 
+      if (ph[i].p_type != PT_LOAD)
+        ABORT ("unknown segment type");
+
       if (i == 0)
         {
           if (ph[i].p_vaddr != 0)
@@ -421,6 +425,8 @@ load_thunk_from_memory (char *data, size_t len, int is_read_only)
 #ifdef HAVE_SYS_MMAN_H
       for (i = 0; i < n; i++)
         {
+          if (ph[i].p_type != PT_LOAD)
+            continue;
           if (ph[i].p_flags == PF_R)
             continue;
           if (ph[i].p_align != 4096)