-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 30/08/13 16:01, Christopher Samuel wrote:

> Thanks for this, I'll take a look further next week..

The code where it's SEGV'ing is here:

  /* check that one of the above allocation paths succeeded */
  if ((unsigned long)(size) >= (unsigned long)(nb + MINSIZE)) {
    remainder_size = size - nb;
    remainder = chunk_at_offset(p, nb);
    av->top = remainder;
    set_head(p, nb | PREV_INUSE | (av != &main_arena ? NON_MAIN_ARENA : 0));
    set_head(remainder, remainder_size | PREV_INUSE);
    check_malloced_chunk(av, p, nb);
    return chunk2mem(p);
  }


It dies when it does:

    set_head(remainder, remainder_size | PREV_INUSE);

where remainder_size=0.

This implies that size and nb are the same, so I'm wondering
if the test at the top of that block should not have the equals,
so instead be this?

  /* check that one of the above allocation paths succeeded */
  if ((unsigned long)(size) > (unsigned long)(nb + MINSIZE)) {

It would ensure that the set_head() macro would never get called
with a 0 argument.

The code would then fall through to the malloc failure part
(which is what I suspect we want).

Thoughts?

All the best,
Chris
- -- 
 Christopher Samuel        Senior Systems Administrator
 VLSCI - Victorian Life Sciences Computation Initiative
 Email: sam...@unimelb.edu.au Phone: +61 (0)3 903 55545
 http://www.vlsci.org.au/      http://twitter.com/vlsci

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlIkJNkACgkQO2KABBYQAh+Y/QCeLwnqEQGK4meKQbETwqHg1RtI
iikAoIofXBPnpI8qbS+zau9ezX78WizW
=QCSz
-----END PGP SIGNATURE-----

Reply via email to