Opened 6 years ago

Closed 5 years ago

#12924 closed defect (fixed)

SchubertPolynomialRing causes symmetrica and Sage to crash on bad input

Reported by: VivianePons Owned by: VivianePons
Priority: major Milestone: sage-5.3
Component: combinatorics Keywords: days38, Schubert polynomials
Cc: sage-combinat, nthiery Merged in: sage-5.3.beta1
Authors: Viviane Pons Reviewers: Mike Hansen
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by VivianePons)

The SchubertPolynomialRing? expects a permutation as an index. When a list is given which is not a permutation, the object is created anyway. The problem comes when one tries to expand the polynomial, if the index is not a valid permutation, it makes symmetrica crash which makes Sage crash !

sage: S = SchubertPolynomialRing(ZZ)                                  
sage: pol = S([2,1,3])
sage: pol.expand()
x0
sage: pol = S([2,1,1])
sage: pol.expand()
function: mult_apply_integer(2) 
python: function: mult_apply_integer(2) 
: Operation not permitted

So the idea would be to check when the polynomial is created that the input is correct and raise an exception at this point if it's not.

New behaviour is now :

sage: X = SchubertPolynomialRing(QQ)
sage: X._element_constructor_([1,2,1])
Traceback (most recent call last):
...
ValueError: The input [1, 2, 1] is not a valid permutation
sage: X._element_constructor_(Permutation([1,2,1]))
Traceback (most recent call last):
...
ValueError: The input [1, 2, 1] is not a valid permutation

Tests have been added into the documentation.

The patch is attached to the ticket and also available into Sage-Combinat

Attachments (2)

trac_12924-Schubert-polynomials-input-bug-vp.patch (2.1 KB) - added by VivianePons 6 years ago.
trac_12924-doc_fix.patch (907 bytes) - added by mhansen 5 years ago.

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by VivianePons

comment:1 Changed 6 years ago by VivianePons

  • Authors set to Viviane Pons
  • Description modified (diff)
  • Status changed from new to needs_review

comment:2 Changed 6 years ago by VivianePons

  • Description modified (diff)

Changed 5 years ago by mhansen

comment:3 Changed 5 years ago by mhansen

  • Reviewers set to Mike Hansen

I've fixed some of the formatting. If you're fine with these changes, you can mark this ticket as positive_review.

comment:4 Changed 5 years ago by VivianePons

It's ok with me ! Thank's for the review

comment:5 Changed 5 years ago by mhansen

  • Status changed from needs_review to positive_review

comment:6 Changed 5 years ago by jdemeyer

  • Merged in set to sage-5.3.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.