fix: `heap-buffer-overflow` in `run_length_encoding.c`
Description of Change
Running run_length_encoding.c leads to heap-buffer-overflow. The encoded is one too short. Moreover, there is an error in this test case:
https://github.com/TheAlgorithms/C/blob/e5dad3fa8def3726ec850ca66a7f51521f8ad393/misc/run_length_encoding.c#L77
Note that the last character of the output of the function run_length_encode has to be the same as the last character of the input.
This PR fixes the mentioned issues and adds new test cases.
References
Checklist
- [x] Added description of change
- [x] Added file name matches File name guidelines
- [x] Added tests and example, test must pass
- [x] Relevant documentation/comments is changed or added
- [x] PR title follows semantic commit guidelines
- [x] Search previous suggestions before making a new one, as yours may be a duplicate.
- [x] I acknowledge that all my contributions will be made under the project's license.
Notes:
This PR fixes the heap-buffer-overflow in run_length_encoding.c.
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@Panquesito7, @tjgurwara99, @alexpantyukhin could some of you please add a dont-close or approved label?