Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream length should be an integer #25

Closed
ekmartin opened this issue May 18, 2018 · 2 comments
Closed

Stream length should be an integer #25

ekmartin opened this issue May 18, 2018 · 2 comments

Comments

@ekmartin
Copy link

Trying to parse this file crashes with a Stream Length should be an integer error. It seems to be caused by the figure included using the LaTeX svg package.

Here's the full stack trace:

thread 'main' panicked at 'Stream Length should be an integer.', libcore/option.rs:914:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:205
   3: std::panicking::default_hook
             at libstd/panicking.rs:221
   4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at libstd/panicking.rs:457
   5: std::panicking::try::do_call
             at libstd/panicking.rs:344
   6: std::panicking::try::do_call
             at libstd/panicking.rs:322
   7: <&'a T as core::fmt::Display>::fmt
             at libcore/panicking.rs:71
   8: core::ptr::drop_in_place
             at libcore/option.rs:914
   9: alloc::raw_vec::alloc_guard
             at /Users/travis/build/rust-lang/rust/src/libcore/option.rs:302
  10: lopdf::parser::stream::{{closure}}
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/lopdf-0.15.1/src/parser.rs:114
  11: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:501
  12: lopdf::encodings::bytes_to_string::{{closure}}
             at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:621
  13: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:501
  14: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  15: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:34
  16: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  17: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:520
  18: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  19: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:516
  20: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  21: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:469
  22: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  23: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:453
  24: lopdf::encodings::bytes_to_string::{{closure}}
             at /Users/travis/build/rust-lang/rust/src/libcore/result.rs:621
  25: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:453
  26: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  27: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:469
  28: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  29: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:469
  30: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  31: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:469
  32: <pdf_word_count::WordCount as core::default::Default>::default
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/pom-1.1.0/src/parser.rs:23
  33: lopdf::reader::Reader::read_object
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/lopdf-0.15.1/src/reader.rs:139
  34: <std::collections::hash::map::RandomState as core::hash::BuildHasher>::build_hasher
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/lopdf-0.15.1/src/reader.rs:91
  35: lopdf::reader::<impl lopdf::document::Document>::load_internal
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/lopdf-0.15.1/src/reader.rs:38
  36: lopdf::reader::<impl lopdf::document::Document>::load_from
             at /Users/ek/.cargo/registry/src/github.com-1ecc6299db9ec823/lopdf-0.15.1/src/reader.rs:26
  37: pdf_word_count::Collector::process_document
             at ./src/lib.rs:27
  38: pdf_wc::main
             at src/main.rs:23
  39: std::rt::lang_start::{{closure}}
             at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
  40: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:304
  41: panic_unwind::dwarf::eh::read_encoded_pointer
             at libpanic_unwind/lib.rs:105
  42: std::sys_common::cleanup
             at libstd/panicking.rs:283
             at libstd/panic.rs:361
             at libstd/rt.rs:58
  43: std::rt::lang_start
             at /Users/travis/build/rust-lang/rust/src/libstd/rt.rs:74
  44: pdf_wc::main
@J-F-Liu
Copy link
Owner

J-F-Liu commented May 22, 2018

The Length value is /Length 58 0 R, but 58 0 obj in object streams, its value is not readable in this parsing stage.

@J-F-Liu
Copy link
Owner

J-F-Liu commented Oct 5, 2018

Fixed in 0.18.0

@J-F-Liu J-F-Liu closed this as completed Oct 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants