Commit bf9db06f26 for aom
commit bf9db06f2615af582f19d443d6e2f8c32d31da6d
Author: Yunqing Wang <yunqingwang@google.com>
Date: Wed Dec 17 16:45:38 2025 -0800
Add a range check for cpi->gf_frame_index
This gives an error for frame_parallel_level array out-of-bounds
access.
Bug: b/468491090
Change-Id: Iebed5d0c689c9fc614708a873f46f8ed9bc11050
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 603fe1bef3..b2e03faac4 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -3577,6 +3577,13 @@ static aom_codec_err_t encoder_encode(aom_codec_alg_priv_t *ctx,
#endif // CONFIG_FPMT_TEST
if (!simulate_parallel_frame) {
+ // Add a range check here to give an error for frame_parallel_level
+ // array out-of-bounds access.
+ if (cpi->gf_frame_index >= MAX_STATIC_GF_GROUP_LENGTH) {
+ aom_internal_error(&ppi->error, AOM_CODEC_ERROR,
+ "cpi->gf_frame_index is out of range");
+ }
+
// May need a better way for checking the frame's frame_parallel_level,
// especially for the first frame of the following gop.
if (ppi->gf_group.frame_parallel_level[cpi->gf_frame_index] == 0) {