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

Missing check for number of bit-planes in j2kenc.c #9

Open
osamu620 opened this issue Sep 6, 2024 · 0 comments
Open

Missing check for number of bit-planes in j2kenc.c #9

osamu620 opened this issue Sep 6, 2024 · 0 comments

Comments

@osamu620
Copy link
Collaborator

osamu620 commented Sep 6, 2024

prec->zerobits[pos].val = expn[bandno] + numgbits - 1 - cblk->nonzerobits;

This line might lead to overflow when (expn[bandno] + numgbits - 1) < cblk->nonzerobits becomes true because prec->zerobits[pos].val is uint8_t.

I propose to add a line for checking like

if ((expn[bandno] + numgbits - 1) < cblk->nonzerobits)
    av_log(avvtx, AV_LOG_ERROR, "Number of magnitude bit-planes is too big.\n");
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

1 participant