vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
1.16k stars 138 forks source link

Crash on PolyRatFun(expand) when the result is zero #114

Closed tueda closed 8 years ago

tueda commented 8 years ago

FORM crashes with the following code:

CF rat;
S x;
L F = rat(x^10,1-x);
P;
.sort
PolyRatFun rat(expand,x,5);
P;
.end

Valgrind output:

==18450== Memcheck, a memory error detector
==18450== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==18450== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==18450== Command: vorm 1
==18450== 
FORM 4.1 (Jul 27 2016, v4.1-20131025-211-g2bd9afd) 64-bits  Run: Wed Jul 27 18:26:29 2016
    CF rat;
    S x;
    L F = rat(x^10,1-x);
    P;
    .sort

Time =       0.14 sec    Generated terms =          1
               F         Terms in output =          1
                         Bytes used      =        128

   F =
      rat(x^10,1 - x);

    PolyRatFun rat(expand,x,5);
    P;
    .end
==18450== Invalid write of size 8
==18450==    at 0x54D5D3: InvPoly (ratio.c:3468)
==18450==    by 0x54CEE8: ExpandRat (ratio.c:3347)
==18450==    by 0x497F74: Normalize (normal.c:3249)
==18450==    by 0x536B11: Generator (proces.c:2982)
==18450==    by 0x52E71F: Processor (proces.c:404)
==18450==    by 0x456F60: DoExecute (execute.c:808)
==18450==    by 0x47E61E: ExecModule (module.c:274)
==18450==    by 0x51CA27: PreProcessor (pre.c:896)
==18450==    by 0x58364A: main (startup.c:1581)
==18450==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==18450== 
Program terminating at 1.frm Line 7 -->