Repository navigation
decoder: Reject out of range u4_disp_buf_id in rel_display_frame - #164
Merged
harishdm merged 1 commit intoNov 29, 2026
Merged
Conversation
harishdm
requested changes
Nov 26, 2026
u4_disp_buf_id arrives from the application in IVD_CMD_REL_DISPLAY_FRAME and is used directly as an index into u4_disp_buf_mapping[] and u4_disp_buf_to_be_freed[], both MAX_DISP_BUFS_NEW entry arrays in dec_struct_t. api_check_struct_sanity() validates only the ip/op struct sizes for this command, so an id outside that range writes past the decoder context in ih264d_rel_display_frame() and isvcd_rel_display_frame(). Reject ids outside the arrays in api_check_struct_sanity() in both decoders, matching the clamp the IVD_CMD_SET_DISPLAY_FRAME path already applies to num_disp_bufs. Ids within range are unaffected.
sage-mode-hunter
force-pushed
the
rel-display-buf-id-bounds
branch
from
November 29, 2026 10:26
0c11782 to
74763aa
Compare
harishdm
approved these changes
Nov 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
u4_disp_buf_idarrives from the application inIVD_CMD_REL_DISPLAY_FRAMEand reaches two fixed size arrays in the decoder context with no range check:ih264d_rel_display_frame()andisvcd_rel_display_frame()indexu4_disp_buf_mapping[]andu4_disp_buf_to_be_freed[], bothMAX_DISP_BUFS_NEW(64) entries indec_struct_t, with it directlyapi_check_struct_sanity()validates only the ip/op struct sizes for this command, so nothing bounds the id on the way inIVD_CMD_SET_DISPLAY_FRAMEpath already clampsnum_disp_bufstoMAX_DISP_BUFS_NEW, which is what makes the asymmetry stand outRepro on an unpatched build: create a decoder, then one
IVD_CMD_REL_DISPLAY_FRAMEwithu4_disp_buf_id = 2048.Ids 0 to 63 behave as before; out of range ids now fail with
IVD_UNSUPPORTEDPARAMinstead of writing past the context. The MVC decoder has noIVD_CMD_REL_DISPLAY_FRAMEhandler, so there is nothing to change there.ctestis green (16/16) and the default build is clean;decoder/svc/isvcd_api.ccompiles clean with-DENABLE_SVC=ON.