gap-system / gap

Main development repository for GAP - Groups, Algorithms, Programming, a System for Computational Discrete Algebra
https://www.gap-system.org
GNU General Public License v2.0
815 stars 161 forks source link

Segmentation fault with `SET_TYPE_COMOBJ` #5847

Closed ArhanChaudhary closed 5 days ago

ArhanChaudhary commented 6 days ago
gap> SET_TYPE_COMOBJ(rec(), 1);
zsh: segmentation fault (core dumped)  gap

Version:

 ┌───────┐   GAP 4.13.1 of 2024-06-11
 │  GAP  │   https://www.gap-system.org
 └───────┘   Architecture: x86_64-pc-linux-gnu-default64-kv9
 Configuration:  gmp 6.3.0, GASMAN, readline
fingolfin commented 5 days ago

Thank you for your report.

SET_TYPE_COMOBJ is an internal kernel function that end users are not supposed to call directly. It doesn't validate its arguments. So this is expected behavior.

ArhanChaudhary commented 5 days ago

Thank you for your report.

SET_TYPE_COMOBJ is an internal kernel function that end users are not supposed to call directly. It doesn't validate its arguments. So this is expected behavior.

I was initially under the same impression, but I saw test cases for this function here which implies use within the user space.

fingolfin commented 5 days ago

That test is part of a bunch of tests for kernel functions. The existence of this test does not imply that users should use this function.

Of course users can call this function. But if they choose to do so, they are on their own, all bets are off, including crashes or worse.