Skip to content

fix(mp4): guard against zero timeScale to prevent +Inf timestamp corruption#2192

Open
MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
MechanicalCoderX:fix/mp4-demuxer-timescale
Open

fix(mp4): guard against zero timeScale to prevent +Inf timestamp corruption#2192
MechanicalCoderX wants to merge 1 commit intoAlexxIT:masterfrom
MechanicalCoderX:fix/mp4-demuxer-timescale

Conversation

@MechanicalCoderX
Copy link
Copy Markdown

When an mdhd atom reports timeScale=0, Probe stored float32(codec.ClockRate)/float32(0) = +Inf in the timeScales map. Demux's existing guard if timeScale == 0 does not catch +Inf, so subsequent packet timestamps were computed as uint32(float32(ts) * +Inf) = 0, corrupting every packet in the track.

Adding && timeScale > 0 to the codec registration condition skips tracks with an invalid timescale instead of storing a bad value.

…uption

When an mdhd atom reported timeScale=0, Probe stored the result of
float32(codec.ClockRate)/float32(0) = +Inf in the timeScales map.
Demux's existing guard `if timeScale == 0` does not catch +Inf, so
subsequent packet timestamps were computed as uint32(float32(ts) * +Inf)
= 0, corrupting every packet in the track.

Adding `&& timeScale > 0` to the codec registration condition skips
tracks with an invalid timescale entirely instead of storing a bad value.
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.

1 participant