From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.ffmpeg.org (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTPS id 0E9414BC74 for ; Mon, 29 Dec 2025 22:32:28 +0000 (UTC) Authentication-Results: ffbox; dkim=fail (body hash mismatch (got b'gsfhpcPdPlNRgQli277GBT4Wfh+k9O+b26I4I4x3Mfw=', expected b'8qgIQH5f0GBcx8lARNuAhXpfl/r2xjYQzOQmGdF1FtA=')) header.d=ffmpeg.org header.i=@ffmpeg.org header.a=rsa-sha256 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767047530; h=mime-version : to : date : message-id : reply-to : subject : list-id : list-archive : list-archive : list-help : list-owner : list-post : list-subscribe : list-unsubscribe : from : cc : content-type : content-transfer-encoding : from; bh=gsfhpcPdPlNRgQli277GBT4Wfh+k9O+b26I4I4x3Mfw=; b=WS22QNUdWDm1Bp8ryJvE1UfheTFwjOg4mbi+hB53XWpi/aDA+lApMIoq2MBwlveQAlfrN DQE4rqJCtHdfpQDEl6BdAQelvEP0nI6U5CGvbDvqBSZ0o5dz0F0wjn+WjS4lxklSiT34zCS eWx2kde7UgopA5A71+YD7sROBw6VVtsP+z3sbPmyrhADLSZ1W5hDLyi/AuzOxkSb8+Ae3Te xxR78wOwJWroHP0MIfNmWZFyj6t1gc1RISafw9vCLz1cnAYKf+0DxzmJFmCOwwhjCkO+MzG a6pMT8cQcNNcWD6+j6UMASa0PObic8rZ1AhRpMo6woa8Pf54Srhc0BEGWjoQ== Received: from [172.20.0.4] (unknown [172.20.0.4]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTP id A3AE1690C15; Tue, 30 Dec 2025 00:32:10 +0200 (EET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=ffmpeg.org; s=arc; t=1767047510; b=OL2XECbY4k8TjvW0iF5nvjTxMPQAaJUyrCkfVsmEK6peuMEacUKYDHr0F6+6vAQYShRkD fLGh6Y9QCIix+vfbrRwioOgr3bTKTFqyZrO3Uxxdcwo/RjUerbQGfQssfPskHhnXss9gmhV ExSRUguH1bnpghOun7FA2WZLOSba2bqwQhXdyL/eqIk8VxiDrKBm5pSzOXK8jaed69m8o+k yVCVfg9Um4f1syarnPkiS0HT9X+Fh8GnHfFaeIQefuuuKn5piY9usBaoibe5SxzZ89S1Kz+ 8En21+sL7Vj+QsLVLbHHEJvFLjybHniSFVX8fwUDNmwe2ZgWgD8/wigdWELg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=ffmpeg.org; s=arc; t=1767047510; h=from : sender : reply-to : subject : date : message-id : to : cc : mime-version : content-type : content-transfer-encoding : content-id : content-description : resent-date : resent-from : resent-sender : resent-to : resent-cc : resent-message-id : in-reply-to : references : list-id : list-help : list-unsubscribe : list-subscribe : list-post : list-owner : list-archive; bh=lj0AE5hHti3IlHuYjKC4btrxowVMbFAKakK54ynzVxI=; b=dwRg6czxkYMZdL3N4EOa+advYxZAmXjoZ8NKm56sBJn8brBlSfMvs6IHpe40WkzOrx2uU PANWLIkQWoHd1dpMjPvgvX6PzXVq1zzz5WpOiTLlVTJMkXy8qRDZn5MngjOf+IbU/J8NICM 5Wwx9DuP9CWcHjOuvTIdV6Qy7Fn9Bb/76M8qH7xa4xoBizg7NLX5fEBGabObFoejXy99Pzp FH8PazmXvVfYdybYV3rFCbUa8UhGvPCBPyuVig9NGUr7tr5+I7KyX66Nr87ZIgGZw/FjyB5 mhNWV/IZ8rGQiMUiYM6hLZ3IjQfWDLYZyLO2dZUZbd5naWrILrrc+UgMzyXQ== ARC-Authentication-Results: i=1; ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none; dmarc=pass header.from=ffmpeg.org policy.dmarc=quarantine Authentication-Results: ffmpeg.org; dkim=pass header.d=ffmpeg.org header.i=@ffmpeg.org; arc=none (Message is not ARC signed); dmarc=pass (Used From Domain Record) header.from=ffmpeg.org policy.dmarc=quarantine DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ffmpeg.org; i=@ffmpeg.org; q=dns/txt; s=mail; t=1767047501; h=content-type : mime-version : content-transfer-encoding : from : to : reply-to : subject : date : from; bh=8qgIQH5f0GBcx8lARNuAhXpfl/r2xjYQzOQmGdF1FtA=; b=cdu66LMBP4iDgx5MqwrSpQbPaGlBAB8056H3aBh5LC8jbnmDihjXv4BxruvuxACsw/07p 7YffbhQK1cPs5Si3Px2cD2Yu6dBFkOUpBUkDBupSqf2Jnb4KwVtWywlkKS4agCgTSAeMOCz B4M9lfC7C1Zp5H2LR2a4iwV5EJguaoaA9AwPxWHvIJRLy0/p3lpzDROJkN+fL+Z/ZBqugmv CzwVmDiSY2mrU/i+dMbenSMuEVteW4w39bHw6BGenHU0QrncdDpXxACoMIM+FYY/q4cY9jp qCbNm+GAfNL+GjfAVgpvdUORmrYowio/1Dnvu+iqj/MNxya7dZNqQUp3xACQ== Received: from 55ca25703178 (code.ffmpeg.org [188.245.149.3]) by ffbox0-bg.ffmpeg.org (Postfix) with ESMTPS id D8F2E690BA1 for ; Tue, 30 Dec 2025 00:31:41 +0200 (EET) MIME-Version: 1.0 To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Dec 2025 22:31:41 -0000 Message-ID: <176704750204.25.6815252230715360014@4457048688e7> Message-ID-Hash: VVH7UE5HVUGNYLUV2IK5C27ZTZ6UEP2X X-Message-ID-Hash: VVH7UE5HVUGNYLUV2IK5C27ZTZ6UEP2X X-MailFrom: code@ffmpeg.org X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-ffmpeg-devel.ffmpeg.org-0; header-match-ffmpeg-devel.ffmpeg.org-1; header-match-ffmpeg-devel.ffmpeg.org-2; header-match-ffmpeg-devel.ffmpeg.org-3; emergency; member-moderation X-Mailman-Version: 3.3.10 Precedence: list Reply-To: FFmpeg development discussions and patches Subject: [FFmpeg-devel] [PATCH] lavc/vvc: Prevent OOB write to slice_top_left_ctu_x in PPS CBS (PR #21317) List-Id: FFmpeg development discussions and patches Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: frankplow via ffmpeg-devel Cc: frankplow Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Archived-At: List-Archive: List-Post: PR #21317 opened by frankplow URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21317 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/21317.patch Prior to the fix, in the case of a tile containing multiple slices (pps_num_exp_slices_in_tile != 0) the number of slices was temporarily allowed to exceed pps_num_slices_in_pic_minus1+1 and therefore VVC_MAX_SLICES. The number of slices was later verified, but while the current slice index was higher than expected it was used to write to a array of size VVC_MAX_SLICES, leading to an OOB write. To rectify this, the patch adds some checks at an earlier stage, to ensure that the slice index i + j at no point exceeds pps_num_slices_in_pic_minus1. Fixes #YWH-PGM40646-30 >>From 65574e151d92613cda0f8861f71de891c0e060b9 Mon Sep 17 00:00:00 2001 From: Frank Plowman Date: Mon, 29 Dec 2025 22:14:53 +0000 Subject: [PATCH] lavc/vvc: Prevent OOB write to slice_top_left_ctu_x in PPS CBS Prior to the fix, in the case of a tile containing multiple slices (pps_num_exp_slices_in_tile != 0) the number of slices was temporarily allowed to exceed pps_num_slices_in_pic_minus1+1 and therefore VVC_MAX_SLICES. The number of slices was later verified, but while the current slice index was higher than expected it was used to write to a array of size VVC_MAX_SLICES, leading to an OOB write. To rectify this, the patch adds some checks at an earlier stage, to ensure that the slice index i + j at no point exceeds pps_num_slices_in_pic_minus1. Fixes #YWH-PGM40646-30 --- libavcodec/cbs_h266_syntax_template.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index d9a65a9c19..4f6ae76e27 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -2011,6 +2011,12 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw, slice_top_left_ctu_y[i] = ctu_y; } else { uint16_t slice_height_in_ctus; + int num_uniform_slices; + + if (i + current->pps_num_exp_slices_in_tile[i] > + current->pps_num_slices_in_pic_minus1 + 1) + return AVERROR_INVALIDDATA; + for (j = 0; j < current->pps_num_exp_slices_in_tile[i]; j++) { ues(pps_exp_slice_height_in_ctus_minus1[i][j], 0, @@ -2031,6 +2037,13 @@ static int FUNC(pps) (CodedBitstreamContext *ctx, RWContext *rw, uniform_slice_height = 1 + (j == 0 ? current->row_height_val[tile_y] - 1: current->pps_exp_slice_height_in_ctus_minus1[i][j-1]); + + num_uniform_slices = (remaining_height_in_ctbs_y + uniform_slice_height - 1) + / uniform_slice_height; + if (i + current->pps_num_exp_slices_in_tile[i] + num_uniform_slices > + current->pps_num_slices_in_pic_minus1 + 1) + return AVERROR_INVALIDDATA; + while (remaining_height_in_ctbs_y > uniform_slice_height) { current->slice_height_in_ctus[i + j] = uniform_slice_height; -- 2.49.1 _______________________________________________ ffmpeg-devel mailing list -- ffmpeg-devel@ffmpeg.org To unsubscribe send an email to ffmpeg-devel-leave@ffmpeg.org