-
-
Notifications
You must be signed in to change notification settings - Fork 491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory corruption in polynomial complex_roots() method #9826
Comments
Author: Johan Bosman |
comment:1
The bug is caused by a deallocation method trying to clean up all coefficients of a polynomial, which segfaults if not all coefficients have been initialised, which in turn happens if the init gets wrong input. The attached patch should fix this. By the way, it is not clear to me why the milestone was set to sage-5.0. I thought that was for Windows-related issues. Please correct me if I'm wrong. |
comment:2
The patch also fixes #10901. |
Refreshed patch, with a doctest. |
comment:3
Attachment: sage-trac_9826.patch.gz The fix works and makes sense to me (positive review for that). I've added a doctest (needs review), and rebased the original patch against 4.8.alpha5. Unfortunately, something is wrong with exceptions at the moment:
and that's fixed by Simon King's patch in #11900, so I've added a dependency there. The milestone update is to match #11900. |
Dependencies: #11900 |
Changed author from Johan Bosman to Johan Bosman, Michael Orlitzky |
comment:4
Nevermind that; the ERRORs still happen in 4.8.alpha6, but the doctests don't seem bothered. |
Changed dependencies from #11900 to none |
This comment has been minimized.
This comment has been minimized.
comment:5
In sage-5.0.beta4 this all works fine, so if you're okay with this, I suggest we give this ticket a positive review. |
Reviewer: Michael Orlitzky, Johan Bosman |
comment:6
Well, we should definitely keep the doctest since this was a bug that was somehow fixed. It looks to me like your original fix is still valid, though, from my not-too-deep understanding of mpfr. I'll ask on sage-devel. |
comment:7
Do you mean "uninitialized" instead of "ininitialized"? |
comment:8
Apply sage-trac_9826.patch (for patchbot) |
Changed reviewer from Michael Orlitzky, Johan Bosman to Michael Orlitzky, Johan Bosman, Volker Braun |
comment:9
This should have been merged a while ago! |
Same patch with my typo fixed. |
This comment has been minimized.
This comment has been minimized.
comment:10
Attachment: sage-trac_9826-typofix.patch.gz I guess I should finally fix that typo, huh. The only change is to spell "uninitialized" correctly, but I'm uploading a separate patch since it's got a positive review. |
Merged: sage-5.0.beta14 |
Obviously the following code should raise an error (which is correctly given at the end), but it shouldn't be trying to
free()
non-aligned pointers.If you run the code
P.random_element().complex_roots()
a few more times, you get a segfault:Environment: Sage 4.5.2 on Mac OS X 10.5.8 (32 bit).
Apply attachment: sage-trac_9826-typofix.patch to the sage repository.
CC: @orlitzky
Component: commutative algebra
Keywords: complex root, polynomial, finite field
Author: Johan Bosman, Michael Orlitzky
Reviewer: Michael Orlitzky, Johan Bosman, Volker Braun
Merged: sage-5.0.beta14
Issue created by migration from https://trac.sagemath.org/ticket/9826
The text was updated successfully, but these errors were encountered: