opj_j2k_is_imf_compliant: Fix out of bounds access.
Previously when mainlevel was parsed == 12 openjpeg would generate a warning, but then the sublevel value would be compared to an out of bounds element in the tabMaxSubLevelFromMainLevel array. From this commit OpenJPEG will only use mainlevel if in range.
This commit is contained in:
parent
00beb20953
commit
e0993d072a
|
@ -7101,19 +7101,21 @@ static OPJ_BOOL opj_j2k_is_imf_compliant(opj_cparameters_t *parameters,
|
||||||
mainlevel);
|
mainlevel);
|
||||||
ret = OPJ_FALSE;
|
ret = OPJ_FALSE;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/* Validate sublevel */
|
{
|
||||||
assert(sizeof(tabMaxSubLevelFromMainLevel) ==
|
/* Validate sublevel */
|
||||||
(OPJ_IMF_MAINLEVEL_MAX + 1) * sizeof(tabMaxSubLevelFromMainLevel[0]));
|
assert(sizeof(tabMaxSubLevelFromMainLevel) ==
|
||||||
if (sublevel > tabMaxSubLevelFromMainLevel[mainlevel]) {
|
(OPJ_IMF_MAINLEVEL_MAX + 1) * sizeof(tabMaxSubLevelFromMainLevel[0]));
|
||||||
opj_event_msg(p_manager, EVT_WARNING,
|
if (sublevel > tabMaxSubLevelFromMainLevel[mainlevel]) {
|
||||||
"IMF profile require sublevel <= %d for mainlevel = %d.\n"
|
opj_event_msg(p_manager, EVT_WARNING,
|
||||||
"-> %d is thus not compliant\n"
|
"IMF profile require sublevel <= %d for mainlevel = %d.\n"
|
||||||
"-> Non-IMF codestream will be generated\n",
|
"-> %d is thus not compliant\n"
|
||||||
tabMaxSubLevelFromMainLevel[mainlevel],
|
"-> Non-IMF codestream will be generated\n",
|
||||||
mainlevel,
|
tabMaxSubLevelFromMainLevel[mainlevel],
|
||||||
sublevel);
|
mainlevel,
|
||||||
ret = OPJ_FALSE;
|
sublevel);
|
||||||
|
ret = OPJ_FALSE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Number of components */
|
/* Number of components */
|
||||||
|
|
Loading…
Reference in New Issue