Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak in time_alloc #4308

Closed
clayton-shopify opened this Issue Mar 1, 2019 · 0 comments

Comments

Projects
None yet
1 participant
@clayton-shopify
Copy link
Contributor

commented Mar 1, 2019

The following input demonstrates a memory leak:

loop do
  Time.at(100000000000000000)
rescue ArgumentError
end

It appears the issue occurs because mrb_malloc is called here:

tm = (struct mrb_time *)mrb_malloc(mrb, sizeof(struct mrb_time));

After that, a call to time_update_datetime is made:
time_update_datetime(mrb, tm);

But time_update_datetime raises if the input value is out of range, and in that case it seems that tm leaks.

This issue was reported by Bhargava Shastry (https://hackerone.com/bags).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.