Skip to content

Fix out-of-bounds iteration in PhraseMaker._updateTupletValue #8302

Description

@s1dhu98

The PhraseMaker widget (js/widgets/phrasemaker.js) uses loops in _updateTupletValue that iterate with for (let i = 0; i <= this.activity.logo.tupletRhythms.length; i++), which can iterate one past the end of the tupletRhythms array and cause out-of-bounds access and runtime errors.

Suggested fix: replace <= with < for the affected loops so iteration goes from 0..length-1.

Files to change:

  • js/widgets/phrasemaker.js

How to validate:

  • Open the PhraseMaker widget and exercise tuplet editing (increase/decrease tuplet values) to ensure no console errors.
  • Run npx prettier --check js/widgets/phrasemaker.js and relevant lint/tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions