#11771: sage crashes on some degenerate flint xgcd's
--------------------------------+-------------------------------------------
   Reporter:  lftabera          |          Owner:  AlexGhitza                  
       Type:  defect            |         Status:  new                         
   Priority:  critical          |      Milestone:  sage-4.7.2                  
  Component:  basic arithmetic  |       Keywords:  flint, crash, xgcd fmpq_poly
Work_issues:                    |       Upstream:  N/A                         
   Reviewer:                    |         Author:                              
     Merged:                    |   Dependencies:                              
--------------------------------+-------------------------------------------

Comment(by leif):

 With FLINT 1.6 (compiled with GMP 5.0.1 and MPFR 3.0.0-p3), fmpq_poly
 0.1.8 I get:
 {{{
 ...
 Now trying xgcd()...
 ==6335== Invalid write of size 8
 ==6335==    at 0x4E69CDF: fmpz_mul (mpn_extras.h:100)
 ==6335==    by 0x409DAA: fmpq_poly_xgcd (fmpq_poly.c:2372)
 ==6335==    by 0x4028AF: main (fmpq_poly-example-2.c:56)
 ==6335==  Address 0x6479440 is not stack'd, malloc'd or (recently) free'd
 ==6335==
 ==6335== Invalid read of size 8
 ==6335==    at 0x4E69A87: fmpz_mul (fmpz.c:442)
 ==6335==    by 0x409DC8: fmpq_poly_xgcd (fmpq_poly.c:2373)
 ==6335==    by 0x4028AF: main (fmpq_poly-example-2.c:56)
 ==6335==  Address 0x6479440 is not stack'd, malloc'd or (recently) free'd
 ==6335==
 ==6335== Invalid read of size 8
 ==6335==    at 0x5553CD6: __gmpn_mul_basecase (tmp-mul_basecase.s:186)
 ==6335==    by 0x6477B37: ???
 ==6335==    by 0x321: ???
 ==6335==    by 0x664F607: ???
 ==6335==  Address 0x6479420 is 0 bytes after a block of size 6,384 alloc'd
 ==6335==    at 0x4C26F60: malloc (vg_replace_malloc.c:236)
 ==6335==    by 0x4E6191C: flint_heap_alloc (memory-manager.c:529)
 ==6335==    by 0x4029F7: fmpz_init (fmpz.h:80)
 ==6335==    by 0x409CE9: fmpq_poly_xgcd (fmpq_poly.c:2366)
 ==6335==    by 0x4028AF: main (fmpq_poly-example-2.c:56)
 ==6335==
 ==6335== Invalid read of size 8
 ==6335==    at 0x5553C98: __gmpn_mul_basecase (tmp-mul_basecase.s:165)
 ==6335==    by 0x6477B37: ???
 ==6335==    by 0x321: ???
 ==6335==    by 0x664F607: ???
 ==6335==  Address 0x6479428 is 8 bytes after a block of size 6,384 alloc'd
 ==6335==    at 0x4C26F60: malloc (vg_replace_malloc.c:236)
 ==6335==    by 0x4E6191C: flint_heap_alloc (memory-manager.c:529)
 ==6335==    by 0x4029F7: fmpz_init (fmpz.h:80)
 ==6335==    by 0x409CE9: fmpq_poly_xgcd (fmpq_poly.c:2366)
 ==6335==    by 0x4028AF: main (fmpq_poly-example-2.c:56)
 ==6335==
 ==6335== Invalid read of size 8
 ==6335==    at 0x5553CAF: __gmpn_mul_basecase (tmp-mul_basecase.s:174)
 ==6335==    by 0x6477B37: ???
 ==6335==    by 0x321: ???
 ==6335==    by 0x664F607: ???
 ==6335==  Address 0x6479430 is not stack'd, malloc'd or (recently) free'd
 ==6335==
 ==6335== Invalid read of size 8
 ==6335==    at 0x5553CC1: __gmpn_mul_basecase (tmp-mul_basecase.s:180)
 ==6335==    by 0x6477B37: ???
 ==6335==    by 0x321: ???
 ==6335==    by 0x664F607: ???
 ==6335==  Address 0x6479438 is not stack'd, malloc'd or (recently) free'd
 ==6335==

 valgrind: m_mallocfree.c:248 (get_bszB_as_is): Assertion 'bszB_lo ==
 bszB_hi' failed.
 valgrind: Heap block lo/hi size mismatch: lo = 29, hi =
 7715086580855095582.
 This is probably caused by your program erroneously writing past the
 end of a heap block and corrupting heap metadata.  If you fix any
 invalid writes reported by Memcheck, this assertion failure will
 probably go away.  Please try that before reporting this as a bug.

 ...
 }}}
 (The output with FLINT 1.5.2 looks similar.)

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/11771#comment:13>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to