Hi,

In `libc/hurd/hurdmalloc.c:281' there is an assertion that is triggered 
when SIZE has value ((1 << 31) - 1).  Instead of assertion failure the 
function must return 0.  Here is a patch that checks SIZE in different way.

BTW I didn't compile neither the previous patched `hurdchdir.c' nor this 
patched `hurdmalloc.c'.  I'm not sure if the second test in the `if' 
statement is completely correct (you know, c-casting, int < unsigned).

Regards
-- 
Ognyan Kulev <[EMAIL PROTECTED]>, "\"Programmer\""
2002-03-25  Ognyan Kulev <[EMAIL PROTECTED]>

         * hurdmalloc.c (malloc): The sanity check for SIZE is rewritten.
--- hurdmalloc.c.orig   Mon Mar 25 16:30:17 2002
+++ hurdmalloc.c        Mon Mar 25 19:16:56 2002
@@ -265,9 +265,10 @@ malloc(size)
        register free_list_t fl;
        register header_t h;
 
-       if ((int) size < 0)             /* sanity check */
-               return 0;
        size += HEADER_SIZE;
+       if (size < HEADER_SIZE
+           || (1 << (NBUCKETS - 1 + LOG2_MIN_SIZE)) < size)
+         return 0;
        /*
         * Find smallest power-of-two block size
         * big enough to hold requested size plus header.

Reply via email to