avcodec/hevc/ps: Check window parameters

Fixes: signed integer overflow: -1094995529 * 2 cannot be represented in type 'int'
Fixes: 484567435/clusterfuzz-testcase-minimized-ffmpeg_dem_HXVS_fuzzer-5628836988649472

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 82f097c825)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer
2026-02-22 21:51:01 +01:00
parent bcee8b9f0b
commit e3ce59ba68
+7
View File
@@ -71,6 +71,13 @@ static int read_window(HEVCWindow *window, GetBitContext *gb, int chroma_format_
int64_t top = get_ue_golomb_long(gb) * vert_mult;
int64_t bottom = get_ue_golomb_long(gb) * vert_mult;
if (left < 0 || right < 0 || top < 0 || bottom < 0 ||
w <= left + right ||
h <= top + bottom) {
memset(window, 0, sizeof(*window));
return AVERROR_INVALIDDATA;
}
window->left_offset = left;
window->right_offset = right;
window->top_offset = top;