Ticket #12173: degree.patch

File degree.patch, 834 bytes (added by jpflori, 10 years ago)

Set length to its correct value in a realloc

  • sage/rings/polynomial/polynomial_integer_dense_flint.pyx

    # HG changeset patch
    # User Jean-Pierre Flori <jean-pierre.flor@ssi.gouv.fr>
    # Date 1338990099 -7200
    # Node ID f7a73245b276fe4e4ea0912a160d081460794c1a
    # Parent  a12db46c3e5f0681512ee4d8b889ea80c1a6dab5
    #12173: Set correct length in realloc
    
    diff --git a/sage/rings/polynomial/polynomial_integer_dense_flint.pyx b/sage/rings/polynomial/polynomial_integer_dense_flint.pyx
    a b  
    204204                    degree = i
    205205            try:
    206206                sig_on()
    207                 fmpz_poly_realloc(self.__poly, degree)
     207                fmpz_poly_realloc(self.__poly, degree + 1)
    208208                sig_off()
    209209            except RuntimeError:
    210210                raise OverflowError, "Cannot allocate memory!"