[EMAIL PROTECTED] wrote:
 > Dear Gilles,
 > 
 > I admit, the mechanism for allocating all memory of the target is not very 
 > sophisticated. The idea was, that MAXHEAPBLOCKS*MEMORYCHUNKSIZE is much much 
 > more, than memory available (at least with my target (128MB) this is true). 
 > I should have mentioned this in the source code, sorry. If your target has 
 > more then (MAXHEAPBLOCKS*MEMORYCHUNKSIZE=320MB(approcimate)) memory, you 
 > should increase MAXHEAPBLOCKS.
 > 
 > If this condition is fulfiled, I think, there should be no illegal memory 
 > access. Do you agree ?
 > 

A better patch.

-- 


                                            Gilles Chanteperdrix.
--- heap.c~     2006-09-06 14:27:31.000000000 +0200
+++ heap.c      2006-09-06 14:37:07.000000000 +0200
@@ -101,7 +101,15 @@ void display(void *cookie)
    {
       memsize+=addsize;
       if(!(ret=rt_heap_create(&bigheap[i],nbuf,memsize,H_PRIO|H_MAPPABLE)))
+      {
+        if (i > MAXHEAPBLOCKS - 1)
+        {
+           printf("i= %d is out of bounds, stopping here, avoid later SEGV.\n",
+                  i);
+           exit(EXIT_FAILURE);
+        }
          rt_heap_delete(&bigheap[i]);
+      }
    }while(ret==0);
 
    memsize>>=1;
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to