CVE-2026-58933 AI-generated analysis
platform/frameworks/av, media/codec2 software APV decoder (C2SoftApvDec)
Makes C2SoftApvDec track mWidth/mHeight only from the primary frame of a multi-frame APV access unit. In outputBuffer(), before fetching and filling the output graphic block, it checks mWidth/mHeight against the actual dimensions of the primary-frame image buffer and overwrites them when they differ.
Root cause
In C2SoftApvDec::process(), the loop over all frames of an access unit (aui.frm_info[i], i < mOutFrames.num_frms) updated mWidth/mHeight unconditionally whenever finfo->w/h differed. After the loop, mWidth/mHeight therefore held the dimensions of the last frame in the AU, not those of the primary frame. Each frame's imgb is created with its own finfo->w/h. Per the commit message, the output is copied from the primary frame's buffer, which can be smaller than the frame described by mWidth/mHeight. outputBuffer() fetches a graphic block sized from mWidth/mHeight, and this mismatch leads to a heap out-of-bounds read. The MAX_SUPPORTED check also ran on mWidth/mHeight rather than on each frame's own dimensions.
How the fix works
- media/codec2/components/apv/C2SoftApvDec.cpp:C2SoftApvDec::process(): the MAX_SUPPORTED_WIDTH/MAX_SUPPORTED_HEIGHT check now runs before the state update and tests finfo->w/finfo->h of every frame directly. It still returns C2_CORRUPTED on failure.
- media/codec2/components/apv/C2SoftApvDec.cpp:C2SoftApvDec::process(): mWidth/mHeight are now updated only when finfo->pbu_type == OAPV_PBU_TYPE_PRIMARY_FRAME and no resolution change has already been recorded in this AU (!reportResolutionChange). Non-primary frames no longer change the tracked dimensions. Per-frame imgb creation and release with finfo->w/h is unchanged.
- media/codec2/components/apv/C2SoftApvDec.cpp:C2SoftApvDec::outputBuffer(): before fetchGraphicBlock, the code reads outWidth = imgbOutput->w[0] and outHeight = imgbOutput->h[0]. If either is 0 or exceeds MAX_SUPPORTED_WIDTH/HEIGHT, it logs, sets work->result = C2_CORRUPTED and returns UNKNOWN_ERROR.
- media/codec2/components/apv/C2SoftApvDec.cpp:C2SoftApvDec::outputBuffer(): if outWidth/outHeight differ from mWidth/mHeight, it logs a warning and overwrites mWidth/mHeight with the imgb values. The following fetchGraphicBlock(align(mWidth,16), align(mHeight,16)) then uses the dimensions of the primary-frame imgb.
Completeness
- The fix addresses the described mismatch in two places. process() no longer lets non-primary frames set mWidth/mHeight. outputBuffer() makes the dimensions used for the output block match plane 0 of the primary-frame imgb.
- outputBuffer() checks only plane 0 (w[0], h[0]) of imgbOutput. The diff does not validate chroma plane sizes. The material does not show whether the copy code relies on the other planes being consistent.
- When outputBuffer() corrects mWidth/mHeight, it only logs (ALOGW) and does not send a resolution-change notification in that path. The material does not show any resolution-change reporting after the loop in process(), so a possible divergence between the reported and actual output size cannot be assessed.
- Because of the !reportResolutionChange guard, only the first primary frame with a differing size updates the state within one AU. The material does not show how imgbOutput is selected among frames.
Behavior changes
- Any frame in an AU whose own finfo->w/h exceed MAX_SUPPORTED_WIDTH/HEIGHT causes C2_CORRUPTED. The log now prints that frame's own values.
- New failure in outputBuffer(): a primary-frame imgb with zero or over-maximum plane-0 dimensions returns UNKNOWN_ERROR with work->result = C2_CORRUPTED.
- New ALOGW in outputBuffer(), with silent correction of mWidth/mHeight, when they disagree with the primary frame's imgb. The output graphic block size now follows the imgb rather than the tracked state.
- Non-primary frames in an AU no longer set reportResolutionChange or change mWidth/mHeight.
Per major
- Android 14: Code absent / not affected: media/codec2/components/apv/C2SoftApvDec.cpp does not exist at android-security-14.0.0_r31, and the bulletin does not list 14.
- Android 15: Code absent / not affected: media/codec2/components/apv/C2SoftApvDec.cpp does not exist at android-security-15.0.0_r19, and the bulletin does not list 15.
- Android 16: Same fix: commit 6d637c9120d2 in android-security-16.0.0_r10 (Change-Id I0da9aac6c81130dbed10a9cc61e5d8d40c60c807, with two Cherrypick-From trailers). The code context at r10 shows the patched process() loop. The resolver reports that 6 of 8 lines of the patched region are present.
- Android 17: Same fix: commit da61a9704b8a in android-security-17.0.0_r3. The diff is identical except for hunk offsets (process() at line 972 vs 971, outputBuffer() at 1333 vs 1328). The resolver reports that 6 of 8 lines of the patched region are present.
Unknowns
- The material does not include the copy loop in outputBuffer() that reads from imgbOutput, or how imgbOutput is chosen among mOutFrames.frm[].
- The material does not show the resolution-change reporting code after the loop in process(), so its interaction with the silent correction in outputBuffer() cannot be assessed.
- The material does not show whether one AU can legitimately contain multiple primary frames, or how the !reportResolutionChange guard behaves in that case.
- The material does not show the attack surface: which process hosts the component and which apps or content can reach it.
- Test coverage: the commit says 'local test' with TEST_IN_POSTSUBMIT, and the diff has no test change.
- The bulletin also lists 16-qpr2 and 17-qpr2-next. The material does not show fix commits for those branches.