linebender / linebender/resvg

Panic `assertion failed: val.is_finite()` in `crates/resvg/src/filter/mod.rs`

Open
#935 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
4.1k
Forks
348
Avg merge
1d 14h
Merged PRs (30d)
3

Description

File content(at the bottom should be attached raw, not formatted file - github removes some non-printable characters, so copying from here may not work):

<svg xmlns:dcnk="http://wworg199lin" xpodi="htp/2">
<defs id="dfs4"><filter colalers="sGB" w="1" y="0" x="0" id="replaceHueFromLayer">
<feComponentTransfer i="qihp" in="p">
<feFuncR d="f" exponent="-1" aitude=".1" type="gamma" />
</feComponentTransfer></filter>
</defs><g id="ay1">
<image :href="data:ig;base64,iVBORw0ANAJYAAACWCAMAAAAQAAAAAIG" xn="t)" style="filter:url(#replaceHueFromLayer)"/></g></svg>

command

timeout -v 100 resvg TEST___FILE.svg

cause this

thread 'main' panicked at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/mod.rs:244:5:
assertion failed: val.is_finite()
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/e4662966273ed58b51f9ff8d682accc202aa1210/library/std/src/panicking.rs:697:5
   1: core::panicking::panic_fmt
             at /rustc/e4662966273ed58b51f9ff8d682accc202aa1210/library/core/src/panicking.rs:75:14
   2: core::panicking::panic
             at /rustc/e4662966273ed58b51f9ff8d682accc202aa1210/library/core/src/panicking.rs:145:5
   3: resvg::filter::f32_bound
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/mod.rs:244:5
   4: resvg::filter::component_transfer::transfer
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/component_transfer.rs:71:6
   5: resvg::filter::component_transfer::apply
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/component_transfer.rs:13:23
   6: resvg::filter::apply_component_transfer
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/mod.rs:892:5
   7: resvg::filter::apply_inner
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/mod.rs:420:17
   8: resvg::filter::apply
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/filter/mod.rs:340:18
   9: resvg::render::render_group
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/render.rs:110:13
  10: resvg::render::render_node
  11: resvg::render::render_nodes
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/render.rs:17:9
  12: resvg::render::render_group
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/render.rs:58:9
  13: resvg::render::render_node
  14: resvg::render::render_nodes
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/render.rs:17:9
  15: resvg::render
             at /home/runner/.cargo/git/checkouts/resvg-2970f6cc9c85afc6/ded4b13/crates/resvg/src/lib.rs:49:5
  16: resvg::check_file
             at ./src/crates/resvg/src/main.rs:40:9
  17: resvg::main
             at ./src/crates/resvg/src/main.rs:21:9
  18: core::ops::function::FnOnce::call_once
             at /home/runner/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:253:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

##### Automatic Fuzzer note, output status "None", output signal "Some(6)"

compressed.zip

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

Start with crates/resvg/src/filter/mod.rs at f32_bound and follow the component-transfer path in crates/resvg/src/filter/component_transfer.rs. Reproduce the report with timeout -v 100 resvg TEST___FILE.svg using the attached SVG, then trace the non-finite value shown in the stack trace. Done means this input no longer causes an assertion panic during rendering.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.