avformat/oggparsevorbis.c: Prevent integer overflow when summing header lengths; add bounds check.

Cherry-picked from 6e0e13b0bf

Signed-off-by: Romain Beauxis <romain.beauxis@gmail.com>
This commit is contained in:
Romain Beauxis 2026-05-21 20:55:41 +00:00
parent d0f9f7a27b
commit fc265ebb9e

View file

@ -223,8 +223,11 @@ static int fixup_vorbis_headers(AVFormatContext *as,
int i, offset, len, err;
int buf_len;
unsigned char *ptr;
uint64_t total_len = (uint64_t)priv->len[0] + priv->len[1] + priv->len[2];
if (total_len + total_len / 255 + 64 > INT_MAX)
return AVERROR_INVALIDDATA;
len = priv->len[0] + priv->len[1] + priv->len[2];
len = total_len;
buf_len = len + len / 255 + 64;
if (*buf)