Skip to content

fix: change the to_int_rect method - #182

Open
Its-Just-Nans wants to merge 5 commits into
linebender:mainfrom
Its-Just-Nans:change-to-int-rect
Open

fix: change the to_int_rect method#182
Its-Just-Nans wants to merge 5 commits into
linebender:mainfrom
Its-Just-Nans:change-to-int-rect

Conversation

@Its-Just-Nans

Copy link
Copy Markdown

The to_int_rect uses an unwrap that can crash because the method from_xywh is converting i32 to u32

pub fn from_xywh(x: i32, y: i32, width: u32, height: u32) -> Option<Self> {                                                                                                         
    x.checked_add(i32::try_from(width).ok()?)?;                                                                                                                                     
    y.checked_add(i32::try_from(height).ok()?)?;

I think to_int_rect should return Option<IntSize>

Note:

@Its-Just-Nans

Its-Just-Nans commented Aug 11, 2026

Copy link
Copy Markdown
Author

Also related to linebender/resvg#935

tiny-skia-path-0.12.0/src/size.rs:89:63:
called `Option::unwrap()` on a `None` value

  11:     0x61cb499bf669 - core[37f591cfbe66b0b1]::option::unwrap_failed
  12:     0x61cb4993f407 - <tiny_skia_path[6b23af959a23f32e]::size::IntSize>::to_int_rect
  13:     0x61cb496f37f6 - <tiny_skia[da2ae6e13adabe9d]::pixmap::PixmapMut>::fill_path
  14:     0x61cb49681423 - resvg[2ecdb20cebe6712c]::path::fill_path
  15:     0x61cb4967db93 - resvg[2ecdb20cebe6712c]::render::render_nodes

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

Successfully merging this pull request may close these issues.

1 participant