Project

General

Profile

Actions

Bug #15651

closed

infinite loop in int_pow

Added by pb (pumbur _) about 5 years ago. Updated about 5 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:91734]

Description

[1].repeated_permutation(1).size goes into infinite loop.

Updated by shyouhei (Shyouhei Urabe) about 5 years ago

zsh % gdb --args ./miniruby -ve '[1].repeated_permutation(1).size'
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./miniruby...done.
(gdb) run
Starting program: /home/shyouhei/data/build/ruby@gcc-8/trunk@git/miniruby -ve \[1\].repeated_permutation\(1\).size
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
ruby 2.7.0dev (2019-03-05 trunk 67168) [x86_64-linux]
^C
Program received signal SIGINT, Interrupt.
int_pow (x=1, y=0) at /trunk/numeric.c:3999
3999                if (!FIT_SQRT_LONG(x)) {
(gdb) bt
#0  int_pow (x=1, y=0) at /trunk/numeric.c:3999
#1  0x000055555579000c in vm_call_cfunc_with_frame (ci=0x555555bd2c80, cc=<optimized out>, calling=0x555555ae68c0, reg_cfp=0x7ffff7fd3fa0, ec=0x555555ab54f8) at /trunk/vm_insnhelper.c:2006
#2  vm_call_cfunc () at /trunk/vm_insnhelper.c:2022
#3  0x0000555555794759 in vm_call_method_each_type.part () at /trunk/vm_insnhelper.c:2344
#4  0x0000555555794d12 in vm_call_method_each_type (cc=<optimized out>, ci=<optimized out>, calling=<optimized out>, cfp=<optimized out>, ec=<optimized out>) at /trunk/vm_insnhelper.c:2468
#5  vm_call_method (cc=<optimized out>, ci=<optimized out>, calling=<optimized out>, cfp=<optimized out>, ec=<optimized out>) at /trunk/vm_insnhelper.c:2496
#6  vm_call_method (ec=0x555555ab54f8, cfp=0x7ffff7fd3fa0, calling=<optimized out>, ci=<optimized out>, cc=<optimized out>) at /trunk/vm_insnhelper.c:2463
#7  0x000055555579b580 in vm_sendish (method_explorer=<optimized out>, block_handler=<optimized out>, cc=<optimized out>, ci=<optimized out>, reg_cfp=<optimized out>, ec=<optimized out>)
    at /trunk/vm_insnhelper.c:3350
#8  vm_exec_core () at ../../../src/trunk/insns.def:782
#9  0x00005555557929c6 in rb_vm_exec () at /trunk/vm.c:1897
#10 0x00005555557a40ea in rb_iseq_eval_main (iseq=<optimized out>) at /trunk/vm.c:2156
#11 0x00005555556087cf in ruby_exec_internal (n=0x555555ad6b00) at /trunk/eval.c:261
#12 0x000055555560c74b in ruby_exec_node (n=<optimized out>) at /trunk/eval.c:325
#13 ruby_run_node (n=<optimized out>) at /trunk/eval.c:317
#14 0x000055555557b0ef in main (argc=<optimized out>, argv=<optimized out>) at /trunk/main.c:42
(gdb)
Actions #2

Updated by nobu (Nobuyoshi Nakada) about 5 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r67203.


numeric.c: fix infinite loop

  • numeric.c (int_pow): fix infinite loop in the case of y equal 1
    and power of x does not overflow.
    [ruby-core:91734] [Bug #15651]
Actions #3

Updated by nagachika (Tomoyuki Chikanaga) about 5 years ago

  • Backport changed from 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN to 2.4: DONTNEED, 2.5: REQUIRED, 2.6: REQUIRED

Updated by nagachika (Tomoyuki Chikanaga) about 5 years ago

  • Backport changed from 2.4: DONTNEED, 2.5: REQUIRED, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONE, 2.6: REQUIRED

ruby_2_5 r67219 merged revision(s) 67203.

Updated by naruse (Yui NARUSE) about 5 years ago

  • Backport changed from 2.4: DONTNEED, 2.5: DONE, 2.6: REQUIRED to 2.4: DONTNEED, 2.5: DONE, 2.6: DONE

ruby_2_6 r67222 merged revision(s) 67203.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0