Skip to content

Fix #EXTINF durations without digits after the decimal point creating bogus segments - #8113

Merged
robwalch merged 1 commit into
video-dev:masterfrom
Enesuygurs:bugfix/extinf-trailing-decimal-point
Oct 22, 2026
Merged

robwalch merged 1 commit into
video-dev:masterfrom
Enesuygurs:bugfix/extinf-trailing-decimal-point

Conversation

@Enesuygurs

Copy link
Copy Markdown
Contributor

This PR will...

Accept #EXTINF durations that have no digits after the decimal point, such as #EXTINF:10.,. The duration group in LEVEL_PLAYLIST_REGEX_FAST was (\d*(?:\.\d+)?), which requires a digit after the dot. It is now (\d+(?:\.\d*)?|\.\d+)?.

Why is this Pull Request needed?

RFC 8216 defines a decimal-floating-point as characters from [0-9] and ., so 10. is a valid duration. The old pattern only captured 10. The leftover ., (or .,title) on the same line then matched the segment URI alternative. For this playlist:

#EXTINF:10.,
segment-1.ts
#EXTINF:4.,title
segment-2.ts

master parses 4 fragments: ., (10s), segment-1.ts (0s), .,title (4s) and segment-2.ts (0s). The made-up URLs fail to load, and the real segments get a duration of 0. With this change the playlist parses as 2 fragments of 10s and 4s, and the title is kept.

Are there any points in the code the reviewer needs to double check?

  • 10, 10.5 and .36 still parse the same way. The existing "without a leading digit" test covers .36.
  • An empty duration or a bare . does not match the group, which is the same as before, so malformed lines behave as they did.

Resolves issues:

Fixes #8112

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

Unit tests: 1242 passed. The new test fails on master with 4 fragments instead of 2. lint, prettier and type-check are clean.

@robwalch robwalch added this to the 1.7.4 milestone Oct 22, 2026
@robwalch
robwalch merged commit 363359c into video-dev:master Oct 22, 2026
12 checks passed
@github-project-automation github-project-automation Bot moved this from Top priorities to Done in HLS.js Release Planning and Backlog Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

#EXTINF durations without digits after the decimal point (e.g. 10.) create bogus segments

2 participants