Skip to content

fix bug #224: Bitmap constructor crash with float dimensions#225

Merged
joshmarinacci merged 1 commit into
masterfrom
fix-224
Jul 8, 2026
Merged

fix bug #224: Bitmap constructor crash with float dimensions#225
joshmarinacci merged 1 commit into
masterfrom
fix-224

Conversation

@joshmarinacci

@joshmarinacci joshmarinacci commented Jul 8, 2026

Copy link
Copy Markdown
Owner

The constructor floored w/h into this.width/height but still used the raw float values for the Uint8Array allocation and fill loop. When the float was just above an integer (e.g. 1100.00027), the loop reached i=1100 which equaled this.width, causing validate_coords to throw "Invalid Index: x N >= width N". Fixed by using this.width/this.height consistently after the floor assignment. Added test/bugs/bug_224.test.ts.

fix for #224

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Description

The constructor floored w/h into this.width/height but still used the
raw float values for the Uint8Array allocation and fill loop. When the
float was just above an integer (e.g. 1100.00027), the loop reached
i=1100 which equaled this.width, causing validate_coords to throw
"Invalid Index: x N >= width N". Fixed by using this.width/this.height
consistently after the floor assignment. Added test/bugs/bug_224.test.ts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@trunk-io

trunk-io Bot commented Jul 8, 2026

Copy link
Copy Markdown

Merging to master in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@joshmarinacci joshmarinacci merged commit dc2f604 into master Jul 8, 2026
1 check passed
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