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

Forward-reverse word iterator mismatch #20

Open
Manishearth opened this issue Feb 23, 2017 · 1 comment
Open

Forward-reverse word iterator mismatch #20

Manishearth opened this issue Feb 23, 2017 · 1 comment

Comments

@Manishearth
Copy link
Member

Manishearth commented Feb 23, 2017

Found by cargo-fuzz.

On the string literal "j\u{FFFD}jjjjjjjjjjj\u{0489}\u{200D}\u{2764}jjjjjjjjj\u{0489}j\u{FFFD}\u{FFFD}\u{FFFD}\"jjjjjj\"jjD\u{0409}\u{0489}0\\f\u{FFFD}".

Base64: agBqampqampqampqatKJ4oCN4p2kampqampqampq0olqAAAAImpqampqaiJqakTQidKJMAwA

As byte array: [0x6a,0x0,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xd2,0x89,0xe2,0x80,0x8d,0xe2,0x9d,0xa4,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0xd2,0x89,0x6a,0x0,0x0,0x0,0x22,0x6a,0x6a,0x6a,0x6a,0x6a,0x6a,0x22,0x6a,0x6a,0x44,0xd0,0x89,0xd2,0x89,0x30,0xc,0x0]

fn main() {
    let s = "j\u{FFFD}jjjjjjjjjjj\u{0489}\u{200D}\u{2764}jjjjjjjjj\u{0489}j\u{FFFD}\u{FFFD}\u{FFFD}\"jjjjjj\"jjD\u{0409}\u{0489}0\\f\u{FFFD}";
    let forward = s.split_word_bounds().collect::<Vec<_>>();
    let forward_reversed = forward.into_iter().rev().collect::<Vec<_>>();
    let reverse = s.split_word_bounds().rev().collect::<Vec<_>>();
    assert_eq!(forward_reversed, reverse);
}

cc @mbrubeck @kwantam

@Manishearth
Copy link
Member Author

Manishearth commented Feb 23, 2017

More examples (base64):

  • 44CAAABEL9KJAAANANKJNNKJOjQAAABqampqauKAjeKdpGpqampq0olrNAAAAAAADAzSiWs00ok6NAAAAAAAAA==
  • DAzSiWs00ok6NAwM0olr4oCN4p2kdS5va9KJazQ00ok0AAAAAAAAAAAAAAAAAAAAAAAAAA4MAQAAawDXogAAaw==
  • AABqampqampqampqatKJ4oCN4p2kampq

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

1 participant