VPAAMP-498 : Fix for out-of-bound access in CheckPreferredTextLanguages()#1590
Open
Abhi-jith-S wants to merge 1 commit into
Open
VPAAMP-498 : Fix for out-of-bound access in CheckPreferredTextLanguages()#1590Abhi-jith-S wants to merge 1 commit into
Abhi-jith-S wants to merge 1 commit into
Conversation
Signed-off-by: Abhi-jith-S <abhijithssa7@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses a crash in PrivateInstanceAAMP::CheckPreferredTextLanguages() by preventing out-of-bounds access when SetPreferredTextLanguages() is invoked (via AAMP JS) before text tracks have been populated.
Changes:
- Add bounds checking around
currentTrackIndexbefore indexing intotrackInfo. - Add a warning log when
currentTrackIndexis out of bounds and is treated as “no selection”.
Comment on lines
+13194
to
13196
| //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()))) | ||
| { |
Comment on lines
+13285
to
+13288
| 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()); |
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.
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