Ticket #13896: double-free-crash.patch

File double-free-crash.patch, 924 bytes (added by nbruin, 9 years ago)

Patch to more reliably produce crash

  • sage/structure/coerce_dict.pyx

    # HG changeset patch
    # User Nils Bruin <nbruin@sfu.ca>
    # Date 1357065238 28800
    # Node ID 0d726dbd96be2f18b2296c76e82decca2491d19c
    # Parent  faa22a1850b281c1b7f978dd2a9bbee8798288a6
    [mq]: double-free-crash.patch
    
    diff --git a/sage/structure/coerce_dict.pyx b/sage/structure/coerce_dict.pyx
    a b  
    3333include "../ext/python_list.pxi"
    3434
    3535from weakref import KeyedRef
     36from gc import collect
    3637
    3738############################################
    3839# The following code is responsible for
     
    116117        # stored key of the unique triple r() had been part of.
    117118        # We remove that unique triple from self.D
    118119        cdef size_t k1,k2,k3
     120        collect()
    119121        k1,k2,k3 = r.key
    120122        cdef size_t h = (k1 + 13*k2 ^ 503*k3)
    121123        cdef list bucket = <object>PyList_GET_ITEM(self.D.buckets, h % PyList_GET_SIZE(self.D.buckets))