- Notifications
You must be signed in to change notification settings - Fork2.7k
fix: cea608 parser make sure pos is within bounds of chars array which has size of NR_COLS#7666
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Open
chelleccarlyle wants to merge1 commit intovideo-dev:masterChoose a base branch fromchelleccarlyle:fix/cea-setPenStyles-index-out-of-bounds-chars
base:master
Could not load branches
Branch not found:{{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline, and old review comments may become outdated.
+191 −4
Conversation
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
…ure pos is within bounds of nr cols array which is 100 and should be 0 index based
Sign up for freeto 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.
Uh oh!
There was an error while loading.Please reload this page.
This PR will...
Fix bounds checks in the
Rowclass:setCursor()clamps positions >=NR_COLStoNR_COLS - 1(0-indexed), and add bounds checks insetPenStyles(),moveCursor(), andbackSpace()to prevent accessingthis.charsbeyond valid indices (0-99 whenNR_COLSis 100), avoidingTypeErrorwhen accessing undefined array elements. Also adds unit tests file for cea608 parser.Why is this Pull Request needed?
Our player is getting type error of undefined when trying to access this.chars[this.pos] or this.chars[i] when index is 100 (should be 99 since 0 based) and trying to call this.chars[i].setPenStyles() which is causing fatal error in our player and causing playback to crash midstream within a few seconds to few minutes.
ex.
TypeError: Cannot read properties of undefined (reading 'setPenState') at Row.setPenStyles happening in node_modules/hls.js/dist/hls.mjsAre there any points in the code the reviewer needs to double check?
No, this PR is mainly adding resiliency to setCursor() and moveCursor() logic of iterating through this.chars array.
Resolves issues:
#7665
Checklist