Skip to content

Panics with 'attempt to shift right with overflow' #649

@jawadcode

Description

@jawadcode

I've been using a python script that utilises the faker and mdgen libraries to generate markdown posts to test out my SSG project, but pulldown_cmark panics with the following on the first post:

    Finished dev [unoptimized + debuginfo] target(s) in 0.03s
     Running `target\debug\reproduce_pulldown_cmark_bug.exe`
thread 'main' panicked at 'attempt to shift right with overflow', C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:1815:21
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library\std\src\panicking.rs:579
   1: core::panicking::panic_fmt
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library\core\src\panicking.rs:64
   2: core::panicking::panic
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library\core\src\panicking.rs:114
   3: pulldown_cmark::firstpass::simd::process_mask<pulldown_cmark::firstpass::impl$0::parse_line::closure_env$0,pulldown_cmark::parse::Item>
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:1815
   4: pulldown_cmark::firstpass::simd::simd_iterate_special_bytes<pulldown_cmark::firstpass::impl$0::parse_line::closure_env$0,pulldown_cmark::parse::Item>
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:1841
   5: pulldown_cmark::firstpass::simd::iterate_special_bytes<pulldown_cmark::firstpass::impl$0::parse_line::closure_env$0,pulldown_cmark::parse::Item>
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:1790
   6: pulldown_cmark::firstpass::iterate_special_bytes<pulldown_cmark::firstpass::impl$0::parse_line::closure_env$0,pulldown_cmark::parse::Item>
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:1539
   7: pulldown_cmark::firstpass::FirstPass::parse_line
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:461
   8: pulldown_cmark::firstpass::FirstPass::parse_paragraph
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:328
   9: pulldown_cmark::firstpass::FirstPass::parse_block
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:202
  10: pulldown_cmark::firstpass::FirstPass::run
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:53
  11: pulldown_cmark::firstpass::run_first_pass
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\firstpass.rs:35
  12: pulldown_cmark::parse::Parser::new_with_broken_link_callback
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\parse.rs:182
  13: pulldown_cmark::parse::Parser::new_ext
             at C:\Users\jawad\.cargo\registry\src\github.com-1ecc6299db9ec823\pulldown-cmark-0.9.3\src\parse.rs:169
  14: reproduce_pulldown_cmark_bug::main
             at .\src\main.rs:8
  15: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
             at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc\library\core\src\ops\function.rs:250
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: process didn't exit successfully: `target\debug\reproduce_pulldown_cmark_bug.exe` (exit code: 101)

I managed to put together a somewhat minimal reproducible example of the bug at https://github.com/jawadcode/reproduce_pulldown_cmark_bug, apologies for not being able to condense it further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions