Skip to content

Fix uninitialized payloadArray in createPayloadForVP8 error path#2293

Open
YPandas wants to merge 2 commits into
developfrom
createPayloadForVP8-logicError-fix
Open

Fix uninitialized payloadArray in createPayloadForVP8 error path#2293
YPandas wants to merge 2 commits into
developfrom
createPayloadForVP8-logicError-fix

Conversation

@YPandas
Copy link
Copy Markdown
Contributor

@YPandas YPandas commented May 21, 2026

Issue #, if available:

  • N/A

What was changed?

  • Added MEMSET(&payloadArray, 0, SIZEOF(payloadArray)) before input validation in createPayloadForVP8()

Why was it changed?

  • When payloadBuffer is non-NULL but pData is NULL, the CHK macro jumps to CleanUp before payloadArray is initialized. The cleanup code only zeroes the struct when sizeCalculationOnly is true, so in this path uninitialized stack values are written to *pPayloadLength and *pPayloadSubLenSize. Detected by clang static analyzer (scan-build).

How was it changed?

  • Moved MEMSET to before the CHK in RtpVP8Payloader.c so the struct is always zeroed regardless of which branch the error path takes.

What testing was done for the changes?

  • Verified locally with a unit test that triggers the error path (non-NULL payloadBuffer, NULL pData/nalus) and confirms output parameters are zeroed instead of garbage.
  • CI/CD to validate no regressions.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Yuqi Huang added 2 commits May 20, 2026 17:43
Move MEMSET before CHK so that payloadArray is zeroed even when
input validation fails early, preventing garbage values from being
written to output parameters.
Test triggers the error path where payloadBuffer is non-NULL but
pData is NULL, verifying output parameters are zeroed instead of
containing uninitialized stack values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants