Skip to content

Commit da6f666

Browse files
committed
fix: off by one on bounds check
1 parent 51c5171 commit da6f666

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

wgpu/src/image/atlas.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,11 @@ impl Atlas {
354354
// bounds check for pad_w low / high to fragment
355355
if pad_w > 0
356356
&& (offset + stride < PIXEL
357-
|| offset + image_width as usize * PIXEL * h + PIXEL
357+
|| offset
358+
+ image_width as usize
359+
* PIXEL
360+
* (h.checked_sub(1).unwrap_or(0))
361+
+ PIXEL
358362
> pixels.len())
359363
{
360364
return;

0 commit comments

Comments
 (0)