History

avcodec/vvc/ctu: check coeff before multiply

ff_vvc_palette_escape_val() can return AVERROR in which case the coeff*scale will overflow.

Kacper Michajłow committed 1 year ago

Commit 75f30b41 parent df5199c1 file · +1 −1Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/vvc/ctu.c+1−1
@@ -2054,9 +2054,9 @@ static int palette_subblock_data(VVCLocalContext *lc, · 2053 unmodified lines
20542054 const int v = PALETTE_INDEX(xc, yc);
20552055 if (v == esc) {
20562056 const int coeff = ff_vvc_palette_escape_val(lc, (1 << sps->bit_depth) - 1);
2057− const int pixel = av_clip_intp2(RSHIFT(coeff * scale, 6), sps->bit_depth);
20582057 if (coeff < 0)
20592058 return AVERROR_INVALIDDATA;
2059+ const int pixel = av_clip_intp2(RSHIFT(coeff * scale, 6), sps->bit_depth);
20602060 PALETTE_SET_PIXEL(xc, yc, pixel);
20612061 } else {
20622062 PALETTE_SET_PIXEL(xc, yc, plt->entries[v]);

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