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

Fix passing invalid rnams to records #3491

Merged
merged 2 commits into from
Jun 11, 2019

Conversation

ChrisJefferson
Copy link
Contributor

@ChrisJefferson ChrisJefferson commented Jun 5, 2019

Fixes #3489

This could be backported to 4.10, but seeing how long it has been around for, I don't think that is required.

Text for release notes

Fix crashes when passing invalid arguments to functions for records: \., IsBound\., Unbind\. and \.\:\=

@ChrisJefferson ChrisJefferson added the kind: bug: crash Issues describing bugs that cause GAP to crash, and PRs fixing them (used for release notes) label Jun 5, 2019
@ChrisJefferson ChrisJefferson force-pushed the fix-rec branch 2 times, most recently from ad8de30 to e091884 Compare June 5, 2019 11:12
@coveralls
Copy link

coveralls commented Jun 5, 2019

Coverage Status

Coverage increased (+0.0009%) to 85.259% when pulling 87c276c on ChrisJefferson:fix-rec into ddfb57a on gap-system:master.

Copy link
Member

@wilfwilson wilfwilson 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 and fixes the problem. I had wondered whether "Record Element" was the correct terminology (as opposed to 'component'), but 29.2 of the manual is called exactly "Record Elements", so I won't complain 🙂

@wilfwilson wilfwilson added kind: bug Issues describing general bugs, and PRs fixing them release notes: to be added PRs introducing changes that should be (but have not yet been) mentioned in the release notes topic: error handling topic: kernel labels Jun 5, 2019
Copy link
Member

@fingolfin fingolfin left a comment

Choose a reason for hiding this comment

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

Looks OK (unsurprisingly -- it is essentially equivalent to the fix I cooked up :-). I still have some optional suggestions.

src/error.c Outdated Show resolved Hide resolved
tst/testinstall/recordname.tst Show resolved Hide resolved
##
gap> r;
rec( )
gap> \.\:\=(r,RNamObj("y"), 2);
Copy link
Member

Choose a reason for hiding this comment

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

You could also use ASS_REC instead of \.\:\=, that might be a bit easier to grok. Same for ISB_REC, ELM_REC, UNB_REC, of course, though there it's perhaps less of a concern.

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'd prefer to use .:= and friends, are those are what we actually document.

@codecov
Copy link

codecov bot commented Jun 9, 2019

Codecov Report

Merging #3491 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #3491      +/-   ##
==========================================
- Coverage   85.43%   85.42%   -0.02%     
==========================================
  Files         699      699              
  Lines      346762   346600     -162     
==========================================
- Hits       296255   296069     -186     
- Misses      50507    50531      +24
Impacted Files Coverage Δ
src/records.c 88.09% <100%> (+0.65%) ⬆️
lib/memusage.gd 87.5% <0%> (-12.5%) ⬇️
lib/system.g 73.47% <0%> (-5.19%) ⬇️
src/sysfiles.c 38.28% <0%> (-3.11%) ⬇️
src/streams.c 75.23% <0%> (-1.4%) ⬇️
src/stringobj.c 93.79% <0%> (-0.6%) ⬇️
lib/polyconw.gi 80.14% <0%> (-0.36%) ⬇️
src/system.c 73.44% <0%> (-0.35%) ⬇️
src/intfuncs.c 97.88% <0%> (-0.23%) ⬇️
src/listfunc.c 97.27% <0%> (-0.2%) ⬇️
... and 7 more

@ChrisJefferson
Copy link
Contributor Author

Cleaned up. In the cleaning up I find one more function (NameRNam) where I could use my new test, so I did.

@@ -28,6 +28,8 @@ Error, NameRName: <rnam> must be a positive small integer (not the integer -1)
gap> NameRNam(fail);
Error, NameRName: <rnam> must be a positive small integer (not the value 'fail\
')
gap> NameRNam(2^29);
Error, NameRName: <rnam> must be a valid rnam (not the integer 536870912)
Copy link
Member

Choose a reason for hiding this comment

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

This error message (and several before it) still has the old, incorrect NameRName in it, which is why the Travis tests failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry, been away from my computer. Now hopefully fixed and poked.

@wilfwilson wilfwilson merged commit bce2111 into gap-system:master Jun 11, 2019
@ChrisJefferson ChrisJefferson deleted the fix-rec branch July 1, 2019 21:15
@wucas wucas 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 Aug 20, 2019
@olexandr-konovalov olexandr-konovalov added this to the GAP 4.11.0 milestone Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug: crash Issues describing bugs that cause GAP to crash, and PRs fixing them (used for release notes) 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 topic: error handling topic: kernel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Segmentation fault on wrong access to record components
6 participants