[PATCH] malloc: Fix for infinite loop in memalign/posix_memalign.

Ryan Arnold ryan.arnold@linaro.org
Wed Oct 30 00:43:00 GMT 2013


On Thu, Oct 10, 2013 at 5:26 AM, Will Newton <will.newton@linaro.org> wrote:
>
> A very large alignment argument passed to mealign/posix_memalign
> causes _int_memalign to enter an infinite loop. Limit the maximum
> alignment value to the maximum representable power of two to
> prevent this from happening.
>
> Changelog:
>
> 2013-10-10  Will Newton  <will.newton@linaro.org>
>
>         [BZ #16038]
>         * malloc/hooks.c (memalign_check): Limit alignment to the
>         maximum representable power of two.
>         * malloc/malloc.c (__libc_memalign): Likewise.
>         * malloc/tst-memalign.c (do_test): Add test for very
>         large alignment values.
>         * malloc/tst-posix_memalign.c (do_test): Likewise.

I think the patch looks good.  Carlos, what do you think?

Ryan



More information about the Libc-alpha mailing list