ruffle icon indicating copy to clipboard operation
ruffle copied to clipboard

Panic in decode_define_bits_lossless reencoding

Open Dinnerbone opened this issue 5 years ago • 1 comments

In Chocobo Dance (v1.04), attempting to reencode a texture into rgba will result in the following panic:

thread 'main' panicked at 'index out of bounds: the len is 33332 but the index is 33332', core\src\backend\render.rs:413:33
stack backtrace:
   0: backtrace::backtrace::trace_unsynchronized
             at C:\Users\VssAdministrator\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.46\src\backtrace\mod.rs:66
   1: std::sys_common::backtrace::_print_fmt
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\sys_common\backtrace.rs:78
   2: std::sys_common::backtrace::_print::{{impl}}::fmt
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\sys_common\backtrace.rs:59
   3: core::fmt::write
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libcore\fmt\mod.rs:1069
   4: std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\io\mod.rs:1504
   5: std::sys_common::backtrace::_print
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\sys_common\backtrace.rs:62
   6: std::sys_common::backtrace::print
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\sys_common\backtrace.rs:49
   7: std::panicking::default_hook::{{closure}}
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\panicking.rs:198
   8: std::panicking::default_hook
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\panicking.rs:218
   9: std::panicking::rust_panic_with_hook
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\panicking.rs:511
  10: std::panicking::begin_panic_handler
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libstd\panicking.rs:419
  11: core::panicking::panic_fmt
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libcore\panicking.rs:111
  12: core::panicking::panic_bounds_check
             at /rustc/49cae55760da0a43428eba73abcb659bb70cf2e4\/src\libcore\panicking.rs:69
  13: core::slice::{{impl}}::index<u8>
             at C:\Users\dinne\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\slice\mod.rs:2872
  14: core::slice::{{impl}}::index<u8,usize>
             at C:\Users\dinne\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\libcore\slice\mod.rs:2732
  15: alloc::vec::{{impl}}::index<u8,usize>
             at C:\Users\dinne\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\src\rust\src\liballoc\vec.rs:1945
  16: ruffle_core::backend::render::decode_define_bits_lossless
             at W:\personal\ruffle\core\src\backend\render.rs:413
  17: ruffle_render_wgpu::{{impl}}::register_bitmap_png<ruffle_render_wgpu::target::SwapChainTarget>
             at W:\personal\ruffle\render\wgpu\src\lib.rs:914
  18: ruffle_core::display_object::movie_clip::MovieClipData::define_bits_lossless
             at W:\personal\ruffle\core\src\display_object\movie_clip.rs:1614
  19: ruffle_core::display_object::movie_clip::{{impl}}::preload::{{closure}}
             at W:\personal\ruffle\core\src\display_object\movie_clip.rs:182
  20: ruffle_core::tag_utils::decode_tags<slice<u8>*,closure-0>
             at W:\personal\ruffle\core\src\tag_utils.rs:285
  21: ruffle_core::display_object::movie_clip::MovieClip::preload
             at W:\personal\ruffle\core\src\display_object\movie_clip.rs:351
  22: ruffle_core::player::{{impl}}::preload::{{closure}}
             at W:\personal\ruffle\core\src\player.rs:762
  23: ruffle_core::player::{{impl}}::mutate_with_update_context::{{closure}}<closure-0,()>
             at W:\personal\ruffle\core\src\player.rs:1115
  24: ruffle_core::player::GcArena::mutate<closure-0,()>
             at C:\Users\dinne\.cargo\registry\src\github.com-1ecc6299db9ec823\gc-arena-0.2.0\src\arena.rs:161
  25: ruffle_core::player::Player::mutate_with_update_context<closure-0,()>
             at W:\personal\ruffle\core\src\player.rs:1062
  26: ruffle_core::player::Player::preload
             at W:\personal\ruffle\core\src\player.rs:759
  27: ruffle_core::player::Player::set_root_movie
             at W:\personal\ruffle\core\src\player.rs:382
  28: ruffle_desktop::run_player
             at .\src\main.rs:181
  29: ruffle_desktop::main

Dinnerbone avatar Sep 17 '20 22:09 Dinnerbone

Here is the error report I'm getting for this SWF:

Error Info

Error name: Error Error message: panicked at 'capacity overflow', library/alloc/src/raw_vec.rs:517:5 Error stack:

966/W/n.wbg.__wbg_new_df6e6ab7a65c4c4d@moz-extension://862c35d8-4b18-4317-b90f-ae1aaf845783/dist/966.js:1:5312
std::sync::once::Once::call_once::{{closure}}::h00e9527065505d48@:wasm-function[939]:0x26955f
std::sync::once::Once::call_inner::h00971925aa1adad3@:wasm-function[1392]:0x2f2912
core::ops::function::FnOnce::call_once{{vtable.shim}}::h962959d96d2b047f@:wasm-function[4848]:0x44efe8
std::panicking::rust_panic_with_hook::h84feca33bd4bd229@:wasm-function[3621]:0x418e27
core::panicking::panic_fmt::hc171d095bc4a492d@:wasm-function[5031]:0x4555ea
alloc::raw_vec::capacity_overflow::hc02fb86712091e0a@:wasm-function[5030]:0x4554ce
ruffle_render::utils::decode_define_bits_lossless::h96b05636c9367b19@:wasm-function[382]:0x10948f
ruffle_render::backend::RenderBackend::register_bitmap_png::h110a48d82f325293@:wasm-function[2524]:0x3bdc54
ruffle_core::display_object::movie_clip::MovieClipData::define_bits_lossless::h8e519913a2efa3a2@:wasm-function[1629]:0x32d2d6
ruffle_core::display_object::movie_clip::MovieClip::preload::h32e87620057db5b9@:wasm-function[818]:0x2300b2
ruffle_core::player::Player::set_root_movie::hdd803949c4220f52@:wasm-function[346]:0xd14bf
<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::hffb5e95a612d5328@:wasm-function[480]:0x16c578
<core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h33c70480059b787d@:wasm-function[952]:0x26de77
wasm_bindgen_futures::queue::Queue::new::{{closure}}::hef1bdbb71c73a68d@:wasm-function[2198]:0x39a137
<dyn core::ops::function::FnMut<(A,)>+Output = R as wasm_bindgen::closure::WasmClosure>::describe::invoke::h714f8411bae5f857@:wasm-function[5406]:0x45f561
closure2944 externref shim@:wasm-function[5534]:0x461d01
S@moz-extension://862c35d8-4b18-4317-b90f-ae1aaf845783/dist/966.js:1:2704
c@moz-extension://862c35d8-4b18-4317-b90f-ae1aaf845783/dist/966.js:1:2229

Player Info

Allows script access: false Renderer: WebGL

Page Info

Page URL: moz-extension://862c35d8-4b18-4317-b90f-ae1aaf845783/player.html?url=https%3A%2F%2Fuploads.ungrounded.net%2F34000%2F34951_chocodance.swf SWF URL: https://uploads.ungrounded.net/34000/34951_chocodance.swf

Browser Info

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:104.0) Gecko/20100101 Firefox/104.0 Platform: Win32 Has touch support: true

Ruffle Info

Version: 0.1.0 Name: nightly 2022-09-09 Channel: nightly Built: 2022-09-09T00:17:18.731Z Commit: c090fe30ad325721c08d5d02f066735a2bed2f8e Is extension: true

Metadata

width: 171 height: 201 frameRate: 10 numFrames: 441 swfVersion: 2 backgroundColor: null isActionScript3: false uncompressedLength: 473283

n0samu avatar Sep 10 '22 05:09 n0samu

Looking at this again, in the desktop app I'm getting the original "index out of bounds" error, while on web I'm still getting the "capacity overflow" error.

n0samu avatar Apr 11 '23 06:04 n0samu

The bounds of the first DefineBitsLossless2 tag are set to 65369 x 65339 pixels. This seems like the same issue as #2759.

n0samu avatar Apr 11 '23 07:04 n0samu