Stack level too deep (SystemStackError) when use zsteg

533 views Asked by At

I want to use zsteg.So I follow the teaching about how to install ruby step by step. But something wrong when zsteg run.

@-VirtualBox:~$ zsteg concat_v.png 
/home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:369:in prev_scanline_byte': stack level too deep (SystemStackError)
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:319:in block in decoded_bytes'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:318:in upto'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:318:in decoded_bytes'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line/mixins.rb:17:in prev_scanline_byte'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:377:in prev_scanline_byte'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:319:in block in decoded_bytes'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:318:in upto'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zpng-0.4.5/lib/zpng/scan_line.rb:318:in decoded_bytes'
     ... 10225 levels...
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zsteg-0.2.13/lib/zsteg.rb:26:in run'
    from /home/weis/.rvm/gems/ruby-3.0.0/gems/zsteg-0.2.13/bin/zsteg:8:in <top (required)>'
    from /home/weis/.rvm/gems/ruby-3.0.0/bin/zsteg:23:in load'
    from /home/weis/.rvm/gems/ruby-3.0.0/bin/zsteg:23:in `<main>'

I has tried to change stack size ulimit -s 16384 But nothing happened.It still show Stack level too deep.I had also install ruby and zsteg again. Really want to know how to solve this problem. (Sorry,I`m not good at English.)

2

There are 2 answers

1
Les Nightingill On

the "stack level too deep" error means that a method is being called recursively, without limiting conditions, like this:

def bad_method
  bad_method # uh-oh it's calling itself!
end
# now call the method
bad_method # => SystemStackError (stack level too deep)

You should see a traceback showing where in the code this is happening, so that you can find the problem. Increasing the permissible stack depth will not solve this problem.

0
Stsong0812 On

Due to the large size of the image, the recursive function used by zsteg is consuming too much stack space. Instead, you can split the image horizontally into two halves online and then analyze each half separately using zsteg.