sagemath / sage

Main repository of SageMath. Now open for Issues and Pull Requests.
https://www.sagemath.org
Other
1.08k stars 394 forks source link

Fix segfault for Weil polynomials #37861

Closed kedlaya closed 1 day ago

kedlaya commented 2 weeks ago

Fix segfault for Weil polynomials

Eliminate a segfault that occurs when asking for Weil polynomials of degree 0 and sign -1 (which do not exist, so the iterator should return empty). This fixes #37860.

roed314 commented 2 weeks ago

LGTM.

kedlaya commented 2 weeks ago

I noticed there is also a segfault when the degree is negative. The root cause is passing a negative degree to dfs_manager, so I moved the check to catch both issues at once, and added a second doctest.

github-actions[bot] commented 2 weeks ago

Documentation preview for this PR (built with commit 95d8beafba006e36b0dc227625891bb940a1e7f8; changes) is ready! :tada: This preview will update shortly after each push to this PR.