Skip to content

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

@osamu620

Description

@osamu620

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");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions