Skip to content

Add include_size check for preventing overflow #1607

@7erryX

Description

@7erryX

CVE-2016-7163

opj_pi_create_decode in src/lib/openjp2/pi.c once caused Integer Overflow and was fixed in Commit c16bc05

Similar code snippet

opj_pi_initialise_encode in src/lib/openjp2/pi.c contains a similar logic (line 1698)

    /* memory allocation for include*/
    l_current_pi->include_size = l_tcp->numlayers * l_step_l;
    l_current_pi->include = (OPJ_INT16*) opj_calloc(l_current_pi->include_size,
                            sizeof(OPJ_INT16));

Would it make sense to add a similar check as the practice of defending programming?

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