Skip to content

Conversation

vil02
Copy link
Member

@vil02 vil02 commented Sep 8, 2025

Description of Change

The Stack class has fixed capacity and can store up to 20 elements. This might lead to a segmentation fault. This PR fixes that, i.e.:

  • adds a test, which causes the old code to fail.
  • it replaced the Stack class by std::stack.

Similar to #2994.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • Search previous suggestions before making a new one, as yours may be a duplicate.
  • I acknowledge that all my contributions will be made under the project's license.

Notes:
Removes a potential segv.

@vil02 vil02 marked this pull request as ready for review September 8, 2025 17:19
@realstealthninja realstealthninja merged commit 3aafade into TheAlgorithms:master Sep 10, 2025
6 of 9 checks passed
@vil02 vil02 deleted the fix_potential_segv_in_postfix_evaluation branch September 10, 2025 11:53
realstealthninja pushed a commit to realstealthninja/C-Plus-Plus that referenced this pull request Oct 1, 2025
realstealthninja added a commit to realstealthninja/C-Plus-Plus that referenced this pull request Oct 1, 2025
realstealthninja added a commit to realstealthninja/C-Plus-Plus that referenced this pull request Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants