Skip to content

VPAAMP 498 ;Fix for out-of-bound access in CheckPreferredTextLanguages()#1589

Open
Abhi-jith-S wants to merge 1 commit into
support/2.11.1_8.4_vipafrom
feature/VPAAMP-498_22
Open

VPAAMP 498 ;Fix for out-of-bound access in CheckPreferredTextLanguages()#1589
Abhi-jith-S wants to merge 1 commit into
support/2.11.1_8.4_vipafrom
feature/VPAAMP-498_22

Conversation

@Abhi-jith-S

Copy link
Copy Markdown
Contributor

Reason for change : Fix for out of bound access happened due to a timing issue where in SetPreferredTextLanguages() in AAMP JS was called before PopulateTextTrack was called.
Test Procedure : Refer ticket
Risks : Medium

Signed-off-by: Abhi-jith-S <abhijithssa7@gmail.com>
@Abhi-jith-S Abhi-jith-S requested a review from a team as a code owner June 10, 2026 13:07
@Abhi-jith-S Abhi-jith-S changed the title Fix for out-of-bound access in CheckPreferredTextLanguages() VPAAMP 498 ;Fix for out-of-bound access in CheckPreferredTextLanguages() Jun 10, 2026
@Abhi-jith-S Abhi-jith-S requested a review from Copilot June 10, 2026 13:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a crash in PrivateInstanceAAMP::CheckPreferredTextLanguages() by preventing out-of-bounds access when GetTextTrack() returns an index that is not valid for the currently available text track list (reported timing issue when preferences are set before text tracks are populated).

Changes:

  • Added an upper-bound check before indexing trackInfo[currentTrackIndex].
  • Added a warning log when currentTrackIndex is out of bounds and the code falls back to treating it as “no selection”.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread priv_aamp.cpp
Comment on lines +12587 to +12591
if (currentTrackIndex >= static_cast<int>(trackInfo.size()))
{
AAMPLOG_WARN("CheckPreferredTextLanguages: currentTrackIndex=%d out of bounds (trackInfo.size()=%zu), treating as no selection",
currentTrackIndex, trackInfo.size());
}
Comment thread priv_aamp.cpp
Comment on lines +12497 to 12498
if (currentTrackIndex >= 0 && !(currentTrackIndex >= static_cast<int>(trackInfo.size())))
{
Comment thread priv_aamp.cpp
Comment on lines +12496 to 12498
//Added out of bound check to prevent crash in case of currentTrackIndex is more than available tracks.
if (currentTrackIndex >= 0 && !(currentTrackIndex >= static_cast<int>(trackInfo.size())))
{
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.

2 participants