linebender / linebender/tiny-skia

Panic : ClipMask::set_path (debug_assert!)

Open
#51 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
1.6k
Forks
99
Avg merge
2h 52m
Merged PRs (30d)
1

Description

The code below panics.
Latest version : tiny-skia = "0.6.6"

The panic come from the a `debug_assert!` in `src/scan/path.rs`

```rust
use tiny_skia::*;

fn main() {
// special value
let v = -6.40969;

let clip_path = {
let mut pb = PathBuilder::new();
pb.push_circle(v, v, v);
// special values
pb.push_circle(823811.0, v, 824467.0);
pb.finish().unwrap()
};

// special values
let clip_path = clip_path.transform(Transform::from_row(v, 824060.0, 0.0, 0.0, 0.0, 0.0)).unwrap();

let mut clip_mask = ClipMask::new();
// panic here
clip_mask.set_path(500, 500, &clip_path, FillRule::EvenOdd, true);
}
```

Stacktrace :

```
thread 'main' panicked at 'assertion failed: edges[curr_idx].last_y >= curr_y as i32', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-skia-0.6.6/src/scan/path.rs:178:13
stack backtrace:
0: rust_begin_unwind
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
1: core::panicking::panic_fmt
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
2: core::panicking::panic
at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
3: tiny_skia::scan::path::walk_edges
at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-skia-0.6.6/src/scan/path.rs:178:13
4: tiny_skia::scan::path::fill_path_impl
at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-skia-0.6.6/src/scan/path.rs:155:5
5: tiny_skia::scan::path_aa::fill_path_impl
at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-skia-0.6.6/src/scan/path_aa.rs:106:5
6: tiny_skia::scan::path_aa::fill_path
at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-skia-0.6.6/src/scan/path_aa.rs:62:5
7: tiny_skia::clip::ClipMask::set_path
at ~/.cargo/registry/src/github.com-1ecc6299db9ec823/tiny-skia-0.6.6/src/clip.rs:94:13
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the provided example with tiny-skia 0.6.6, then inspect src/scan/path.rs around the debug_assert! in walk_edges and the callers in src/scan/path_aa.rs and src/clip.rs. Add regression coverage for the panic case and verify that the same input no longer panics while preserving the expected ClipMask behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
computer-graphics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.