exercism / zig

Exercism exercises in Zig.
https://exercism.org/tracks/zig
MIT License
54 stars 38 forks source link

exercises(all-your-base): three tests are broken because they do not free the returned memory #319

Closed FedericoStra closed 11 months ago

FedericoStra commented 11 months ago

In contrast to all other tests, these three forget to call defer testing.allocator.free(actual);:

https://github.com/exercism/zig/blob/f27476850b38a7c503f9618f6e9b57537c02a0c4/exercises/practice/all-your-base/test_all_your_base.zig#L88-L113

This forces the solution to return a slice always referencing the same global array, which is incorrect because it can be modified hence cannot be guaranteed to be zero.

See for instance these solutions: mine, stgatilov, sezoka.

Some other solutions are even more broken because they return a slice referencing a local array (hence UB): Acaccia, mhennig4711.

github-actions[bot] commented 11 months ago

Hello. Thanks for opening an issue on Exercism. We are currently in a phase of our journey where we have paused community contributions to allow us to take a breather and redesign our community model. You can learn more in this blog post. As such, all issues and PRs in this repository are being automatically closed.

That doesn't mean we're not interested in your ideas, or that if you're stuck on something we don't want to help. The best place to discuss things is with our community on the Exercism Community Forum. You can use this link to copy this into a new topic there.


Note: If this issue has been pre-approved, please link back to this issue on the forum thread and a maintainer or staff member will reopen it.