mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-02-21 14:26:59 +00:00
avcodec/vvc/vvc_ps: Check before access
max_bin_idx can be at most LMCS_MAX_BIN_SIZE - 1 here, so pivot[LCMS_MAX_BIN_SIZE + 1] may be accessed, but pivot has only LCMS_MAX_BIN_SIZE + 1 elements (unless the values of pivot were so that it is always assured that pivot[LCMS_MAX_BIN_SIZE] is always < sample (which it is iff it is always < 2^bit_depth - 1)). So reorder the checks. Reviewed-by: Nuo Mi <nuomi2021@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
parent
1d66a122df
commit
1eafbc27e2
@ -652,7 +652,7 @@ static int lmcs_derive_lut(VVCLMCS *lmcs, const H266RawAPS *rlmcs, const H266Raw
|
||||
i = lmcs->min_bin_idx;
|
||||
for (uint16_t sample = 0; sample < max; sample++) {
|
||||
uint16_t inv_sample;
|
||||
while (sample >= lmcs->pivot[i + 1] && i <= lmcs->max_bin_idx)
|
||||
while (i <= lmcs->max_bin_idx && sample >= lmcs->pivot[i + 1])
|
||||
i++;
|
||||
|
||||
inv_sample = lmcs_derive_lut_sample(sample, input_pivot, lmcs->pivot,
|
||||
|
Loading…
Reference in New Issue
Block a user