Skip to content

Fix lab 10 segmentation fault in tasks#181

Open
robertmercea wants to merge 2 commits into
cs-pub-ro:mainfrom
robertmercea:fix/lab-10
Open

Fix lab 10 segmentation fault in tasks#181
robertmercea wants to merge 2 commits into
cs-pub-ro:mainfrom
robertmercea:fix/lab-10

Conversation

@robertmercea
Copy link
Copy Markdown

@robertmercea robertmercea commented May 14, 2026

Prerequisite Checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Updated relevant documentation (if needed).

Description of changes

Previously, running the executables for the read-stdin-gets and read-stdin-fgets tasks would result in the print_byte loop running indefinitely, resulting in a segmentation fault. This happened because the limit for the iterator was read from the wrong address (or due to stack alignments made by the user).

The fix I provided changes the address from which the limit is read, such that the program no longer crashes.

Fix running the program resulting in segmentation fault by changing the
offset from which the string length is read

Signed-off-by: robertmercea <robertmercea@gmail.com>
Fix running the program resulting in segmentation fault by changing the
offset from which the string length is read

Signed-off-by: robertmercea <robertmercea@gmail.com>
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.

1 participant