C icon indicating copy to clipboard operation
C copied to clipboard

fix: `heap-buffer-overflow` in `run_length_encoding.c`

Open vil02 opened this issue 2 years ago • 2 comments

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.

vil02 avatar Oct 02 '23 15:10 vil02

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.

github-actions[bot] avatar Nov 02 '23 00:11 github-actions[bot]

@Panquesito7, @tjgurwara99, @alexpantyukhin could some of you please add a dont-close or approved label?

vil02 avatar Nov 02 '23 06:11 vil02