quietvoid / hevc_parser

HEVC format parser
MIT License
29 stars 10 forks source link

"Index out of bounds: the len is 1 but the index is 1" in short_term_rps #2

Closed rlaphoenix closed 3 years ago

rlaphoenix commented 3 years ago

The error occurs here: https://github.com/quietvoid/hevc_parser/blob/fd184bd77fa20c5c12e8a1df0df32056971b75ad/src/hevc/short_term_rps.rs#L48

Backtrace:

thread 'main' panicked at 'index out of bounds: the len is 1 but the index is 1', C:\Users\phoenix\.cargo\registry\src\github.com-1ecc6299db9ec823\hevc_parser-0.1.6\src\hevc\short_term_rps.rs:48:28
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\/library\std\src\panicking.rs:515
   1: core::panicking::panic_fmt
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\/library\core\src\panicking.rs:92
   2: core::panicking::panic_bounds_check
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\/library\core\src\panicking.rs:69
   3: core::slice::index::{{impl}}::index<hevc_parser::hevc::short_term_rps::ShortTermRPS>
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\library\core\src\slice\index.rs:184
   4: core::slice::index::{{impl}}::index<hevc_parser::hevc::short_term_rps::ShortTermRPS,usize>
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\library\core\src\slice\index.rs:15
   5: alloc::vec::{{impl}}::index<hevc_parser::hevc::short_term_rps::ShortTermRPS,usize,alloc::alloc::Global>
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\library\alloc\src\vec\mod.rs:2428
   6: hevc_parser::hevc::short_term_rps::ShortTermRPS::parse
             at C:\Users\phoenix\.cargo\registry\src\github.com-1ecc6299db9ec823\hevc_parser-0.1.6\src\hevc\short_term_rps.rs:48
   7: hevc_parser::hevc::sps::SPSNAL::parse
             at C:\Users\phoenix\.cargo\registry\src\github.com-1ecc6299db9ec823\hevc_parser-0.1.6\src\hevc\sps.rs:175
   8: hevc_parser::HevcParser::parse_sps
             at C:\Users\phoenix\.cargo\registry\src\github.com-1ecc6299db9ec823\hevc_parser-0.1.6\src\lib.rs:220
   9: hevc_parser::HevcParser::parse_nal
             at C:\Users\phoenix\.cargo\registry\src\github.com-1ecc6299db9ec823\hevc_parser-0.1.6\src\lib.rs:170
  10: hevc_parser::HevcParser::split_nals
             at C:\Users\phoenix\.cargo\registry\src\github.com-1ecc6299db9ec823\hevc_parser-0.1.6\src\lib.rs:116
  11: dovi_tool::dovi::io::DoviReader::read_write_from_io
             at C:\Users\phoenix\Projects\dovi_tool\src\dovi\io.rs:176
  12: dovi_tool::dovi::rpu_extractor::RpuExtractor::extract_rpu_from_el
             at C:\Users\phoenix\Projects\dovi_tool\src\dovi\rpu_extractor.rs:64
  13: dovi_tool::dovi::rpu_extractor::RpuExtractor::process_input
             at C:\Users\phoenix\Projects\dovi_tool\src\dovi\rpu_extractor.rs:56
  14: dovi_tool::dovi::rpu_extractor::RpuExtractor::extract_rpu
             at C:\Users\phoenix\Projects\dovi_tool\src\dovi\rpu_extractor.rs:45
  15: dovi_tool::main
             at C:\Users\phoenix\Projects\dovi_tool\src\main.rs:72
  16: core::ops::function::FnOnce::call_once<fn(),tuple<>>
             at /rustc/a178d0322ce20e33eac124758e837cbd80a6f633\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

This is using dovi_tool compiled at https://github.com/quietvoid/dovi_tool/commit/f4bc7c802318daa0b8a7314ed4a778457fac35f9

quietvoid commented 3 years ago

~A sample to reproduce the problem would be useful.~ Nevermind, I'm able to reproduce with conformance bitstreams.

quietvoid commented 3 years ago

Should hopefully be fixed by https://github.com/quietvoid/hevc_parser/commit/ccefd5e793894b7d56d93ccd4e9d3952970831c6 Will update the crate version.

rlaphoenix commented 3 years ago

Thank you, it has indeed fixed the problem.