Skip to content

Panic because of level overflow #145

@saecki

Description

@saecki

The follwing code, with the input.txt file panics both on 0.3.18 and on the current main branch (3bf3403a74e4a73e15008001c81c09062e13f280).

use unicode_bidi::{BidiInfo, Level};

fn main() {
    let text = include_str!("input.txt");

    let range = 3071..3082;
    assert_eq!(&text[range.clone()], "@@@><”\03:");

    let bidi = BidiInfo::new(text, Some(Level::ltr()));
    let para = bidi.paragraphs.first().unwrap();
    assert_eq!(para.range, 0..3637);
    assert_eq!(para.level, Level::ltr());

    bidi.visual_runs(para, range);
}

input.txt

thread 'main' panicked at .../.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/unicode-bidi-0.3.18/src/lib.rs:956:47:
Level error: OutOfRangeNumber

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions