Skip to content
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

Bug Fix: The error checking in PartialPerm has been corrected such that invalid inputs (numbers < 1) are detected #3944

Merged
merged 1 commit into from
Apr 11, 2020

Conversation

ChrisJefferson
Copy link
Contributor

Fixes #3943 , corruption caused by invalid inputs (numbers < 1) to PartialPerm

@ChrisJefferson ChrisJefferson added release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes backport-to-4.11 labels Apr 4, 2020
Copy link
Contributor

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@coveralls
Copy link

coveralls commented Apr 5, 2020

Coverage Status

Coverage remained the same at 84.332% when pulling b018ed6 on ChrisJefferson:fix-PartialPerm into 715612f on gap-system:master.

if IsSSortedList(arg[1]) and ForAll(arg[1], IsSmallIntRep)
and IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsSmallIntRep)
if IsSSortedList(arg[1]) and ForAll(arg[1], IsPosInt and IsSmallIntRep)
and IsDuplicateFreeList(arg[2]) and ForAll(arg[2], IsPosInt and IsSmallIntRep)
and Length(arg[1]) = Length(arg[2]) then
return SparsePartialPermNC(arg[1], arg[2]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Strictly speaking I'd feel better if we improved the input validation in SparsePartialPermNC instead or in addition to the above, but as this PR fixes the immediate issue, I'd be happy to see it merged as-is, too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The small pos int and "sorted list" tests can be done very cheaply in the kernel; duplicate free might be more work, though perhaps even that could be done as a side effect of the kernel code. Anyway, as long as there is no performance issue here... shrug

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree porting this all into the kernel might be netter, most of this comes almost for free while you are building the partial permutation (except DuplicateFreeList), but that would be a bigger change, and this little fix feels better for backporting.

Copy link
Contributor

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

Copy link
Contributor

@james-d-mitchell james-d-mitchell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@fingolfin fingolfin merged commit 580aecc into gap-system:master Apr 11, 2020
@fingolfin
Copy link
Member

Backported to stable-4.11 in aac1175

@ChrisJefferson ChrisJefferson deleted the fix-PartialPerm branch February 15, 2021 14:42
@danielrademacher danielrademacher self-assigned this Feb 16, 2021
@danielrademacher danielrademacher changed the title Fix error checking in PartialPerm Bug Fix: The error checking in PartialPerm has been corrected such that invalid inputs (numbers < 1) are detected Feb 16, 2021
@danielrademacher danielrademacher added release notes: added PRs introducing changes that have since been mentioned in the release notes and removed release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes labels Feb 16, 2021
@danielrademacher danielrademacher removed their assignment Feb 16, 2021
@ThomasBreuer ThomasBreuer added the kind: bug Issues describing general bugs, and PRs fixing them label Feb 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-to-4.11-DONE kind: bug Issues describing general bugs, and PRs fixing them release notes: added PRs introducing changes that have since been mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bus error resulting from a short GAP function
7 participants