History

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.

Andreas Rheinhardt committed 2 years ago

Commit 1eafbc21 parent 1d66a121 file · +1 −1Browse files

Unified · Split

libavcodec/vvc/vvc_ps.c+1−1
@@ -652,7 +652,7 @@ static int lmcs_derive_lut(VVCLMCS *lmcs, const H266RawAPS *rlmcs, const H266Raw · 651 unmodified lines
652652 i = lmcs->min_bin_idx;
653653 for (uint16_t sample = 0; sample < max; sample++) {
654654 uint16_t inv_sample;
655− while (sample >= lmcs->pivot[i + 1] && i <= lmcs->max_bin_idx)
655+ while (i <= lmcs->max_bin_idx && sample >= lmcs->pivot[i + 1])
656656 i++;
657657
658658 inv_sample = lmcs_derive_lut_sample(sample, input_pivot, lmcs->pivot,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t