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

Out-of-bounds read in timegm #3368

Closed
clayton-shopify opened this issue Jan 4, 2017 · 0 comments
Closed

Out-of-bounds read in timegm #3368

clayton-shopify opened this issue Jan 4, 2017 · 0 comments

Comments

@clayton-shopify
Copy link
Contributor

An out-of-bounds read can occur here, due to a missing bounds check:

for (i = 0; i < tm->tm_mon; ++i)
r += nday[i] * 24 * 60 * 60;

This can allow memory disclosure:

50.times { |i| puts Time.gm(1972, 12 + i + 1).to_i - Time.gm(1972, 12 + i).to_i }

or a crash:

Time.gm(1972, 0x100000)

MRI disallows months greater than 12, raising ArgumentError: argument out of range.

This issue was reported by https://hackerone.com/volc

@matz matz closed this as completed in c4491e4 Jan 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant