Skip to content

Memory leak in time_alloc #4308

Closed
Closed

Description

@clayton-shopify

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).

Activity

  1. added a commit that references this issue on Jul 16, 2021
    cb7cc7f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions