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

Segmentation fault on wrong access to record components #3489

Closed
ThomasBreuer opened this issue Jun 5, 2019 · 4 comments · Fixed by #3491
Closed

Segmentation fault on wrong access to record components #3489

ThomasBreuer opened this issue Jun 5, 2019 · 4 comments · Fixed by #3491
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 topic: documentation Issues and PRs related to documentation

Comments

@ThomasBreuer
Copy link
Contributor

The following input causes a segmentation fault (already in very old GAP versions).

gap> r:= rec( a:= 1 );;
gap> \.( r, "a" );

I think GAP should better give an appropriate error message.

In addition to that, I think that the documentation is not clear enough in this respect.
The section "Record Access Operations" in the GAP Reference Manual says that record component names are encoded by numbers,
and that the correspondence is implemented by NameRNam and RNamObj.
It does not say what this means for non-infix calls to the operation \.
and to the methods installed for this operation.
In particular it does not show an example.
The following example would already be helpful.

gap> G:= SymmetricGroup( 4 );;
gap> G.1;
(1,2,3,4)
gap> \.( G, RNamObj( 1 ) );
(1,2,3,4)
gap> meth:= ApplicableMethod( \., [ G, 4711 ] );;
gap> meth( G, RNamObj( 1 ) );
(1,2,3,4)

If you agree that extending the documentation this way would be useful
then I can provide a pull request for such a change.

@ThomasBreuer ThomasBreuer added kind: bug: crash Issues describing bugs that cause GAP to crash, and PRs fixing them (used for release notes) topic: documentation Issues and PRs related to documentation labels Jun 5, 2019
@ChrisJefferson
Copy link
Contributor

Good catch! I agree the docs should be better, and also the crash needs fixing.

@ChrisJefferson
Copy link
Contributor

Extra comment (I'm looking at this myself), even if you pas an int, if it's not a valid RNAM (say, it's too big) you get crashes/corruption.

@fingolfin
Copy link
Member

I have a fix for this, but need to clean it up a bit, and also need to teach now, so I'll submit it later.

@fingolfin fingolfin added the kind: bug Issues describing general bugs, and PRs fixing them label Jun 5, 2019
@ChrisJefferson
Copy link
Contributor

I have a seperate fix..

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 topic: documentation Issues and PRs related to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants