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

Use of uninitialized memory in mrb_ptr_to_str #4307

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

Use of uninitialized memory in mrb_ptr_to_str #4307

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

Comments

@clayton-shopify
Copy link
Contributor

@clayton-shopify clayton-shopify commented Mar 1, 2019

The following input demonstrates use of uninitialized memory:

[].methods.sort do |x|
  x.to_proc[Symbol,Kernel].Z
rescue
end.inspect

Valgrind shows the following error:

==5582== Conditional jump or move depends on uninitialised value(s)
==5582==    at 0x409CAF: mrb_ptr_to_str (string.c:1689)
==5582==    by 0x422F15: mrb_any_to_s (object.c:438)
==5582==    by 0x43B853: mrb_obj_inspect (kernel.c:59)
==5582==    by 0x434383: mrb_vm_exec (vm.c:1470)
==5582==    by 0x4392BB: mrb_vm_run (vm.c:978)
==5582==    by 0x43AF78: mrb_top_run (vm.c:3018)
==5582==    by 0x44B86E: mrb_load_exec (parse.y:6139)
==5582==    by 0x44D296: mrb_load_file_cxt (parse.y:6148)
==5582==    by 0x402ED5: main (mruby.c:280)

This issue was reported by Denis Kasak & Dinko Galetić (https://hackerone.com/dgaletic).

@matz matz closed this in 73091ab Mar 2, 2019
matz added a commit that referenced this issue Mar 2, 2019
ksekimoto added a commit to ksekimoto/mruby that referenced this issue Jul 16, 2021
ksekimoto added a commit to ksekimoto/mruby that referenced this issue Jul 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant