Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PaletteStorage.incrementPalette can go out of bounds #183

Open
lowlines opened this issue May 28, 2022 · 1 comment
Open

PaletteStorage.incrementPalette can go out of bounds #183

lowlines opened this issue May 28, 2022 · 1 comment

Comments

@lowlines
Copy link

incrementPalette (palette) {
for (let i = 0; i < this.wordsCount; i++) {
for (let j = 0; j < this.blocksPerWord; j++) {
const ix = this.readBits(i, j * this.bitsPerBlock)
palette[ix].count++
}
}
}

If you have bitsPerBlock size that causes rounding on the wordCount, this double for loop will go beyond the 4096 block range and throw and error.

@extremeheat
Copy link
Member

Please open PR if you have a fix.

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

No branches or pull requests

2 participants