Skip to content

Segmentation Fault when trying to get out-of-bounds index of vector #41249

@MarcusAichmayr

Description

@MarcusAichmayr

Steps To Reproduce

sage: zero_vector(3).get(-1)

or

sage: zero_vector(3).get(5)

Expected Behavior

0, None or an exception

Actual Behavior

...
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------
Segmentation fault (core dumped)

Sage crashes.

Additional Information

When trying to get an index out of the bounds, a Segmentation Fault occurs sometimes and Sage terminates.

Note:
In my limited testing, some indices did not always turn into a segfault. For instance, zero_vector(3).get(5) sometimes did but not always. If you can't reproduce this behavior, try restarting Sage and use different indices as input.

Environment

  • OS: Ubuntu 24.04 (CoCalc)
  • Sage Version: 10.7

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions