Skip to content
This repository has been archived by the owner on Oct 28, 2023. It is now read-only.

Large backtrack-stages setting causes a crash inside ImagePyramid::build_gaussian #55

Open
toomuchsalt opened this issue Oct 10, 2019 · 1 comment
Labels
bug Something isn't working

Comments

@toomuchsalt
Copy link

Setting backtrack-stages to more than log2(image-dimension) leads to a panic inside ImagePyramid::build_gaussian

To Reproduce
Steps to reproduce the behavior:
cargo run -- --backtrack-stages 10 -o out.png generate 500x500.png

Device:

  • OS: Linux 5.3.0-13
  • Compiler: rustc 1.38.0-nightly

Additional context
Crash backtrace

   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
   7: std::panicking::continue_panic_fmt
             at src/libstd/panicking.rs:384
   8: rust_begin_unwind
             at src/libstd/panicking.rs:311
   9: core::panicking::panic_fmt
             at src/libcore/panicking.rs:85
  10: core::panicking::panic
             at src/libcore/panicking.rs:49
  11: core::option::Option<T>::unwrap
             at /rustc/60960a260f7b5c695fd0717311d72ce62dd4eb43/src/libcore/macros.rs:12
  12: image::imageops::sample::horizontal_sample
             at /`hidden`/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/image-0.22.3/./src/imageops/sample.rs:199
  13: image::imageops::sample::resize
             at /`hidden`/.cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/image-0.22.3/./src/imageops/sample.rs:681
  14: texture_synthesis::img_pyramid::ImagePyramid::build_gaussian
             at lib/src/img_pyramid.rs:29
  15: texture_synthesis::img_pyramid::ImagePyramid::new
             at lib/src/img_pyramid.rs:16
  16: texture_synthesis::Example::resolve
             at lib/src/lib.rs:375
  17: texture_synthesis::SessionBuilder::build
             at lib/src/lib.rs:675
  18: texture_synthesis::real_main
             at cli/src/main.rs:283
  19: texture_synthesis::main
             at cli/src/main.rs:182
  20: std::rt::lang_start::{{closure}}
             at /rustc/60960a260f7b5c695fd0717311d72ce62dd4eb43/src/libstd/rt.rs:64
  21: std::rt::lang_start_internal::{{closure}}
             at src/libstd/rt.rs:49
  22: std::panicking::try::do_call
             at src/libstd/panicking.rs:296
  23: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  24: std::panicking::try
             at src/libstd/panicking.rs:275
  25: std::panic::catch_unwind
             at src/libstd/panic.rs:394
  26: std::rt::lang_start_internal
             at src/libstd/rt.rs:48
  27: std::rt::lang_start
             at /rustc/60960a260f7b5c695fd0717311d72ce62dd4eb43/src/libstd/rt.rs:64
  28: main
  29: __libc_start_main
  30: _start
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Process finished with exit code 101
@toomuchsalt toomuchsalt added the bug Something isn't working label Oct 10, 2019
@Jake-Shadle
Copy link
Member

Thanks for reporting this, will need to add some guards to ensure that parameter stays in a proper range based on inputs.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants