Skip to content

Commit

Permalink
Defense against timebase with denominator 0
Browse files Browse the repository at this point in the history
  • Loading branch information
xdrudis committed Jan 2, 2025
1 parent cb28fe3 commit 803fd08
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/media/ivfreader/ivfreader.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var (
errIncompleteFileHeader = errors.New("incomplete file header")
errSignatureMismatch = errors.New("IVF signature mismatch")
errUnknownIVFVersion = errors.New("IVF version unknown, parser may not parse correctly")
errInvalidMediaTimebase = errors.New("invalid media timebase")
)

// IVFFileHeader 32-byte header for IVF files
Expand Down Expand Up @@ -71,6 +72,9 @@ func NewWith(in io.Reader) (*IVFReader, *IVFFileHeader, error) {
if err != nil {
return nil, nil, err
}
if header.TimebaseDenominator == 0 {
return nil, nil, errInvalidMediaTimebase
}

Check warning on line 77 in pkg/media/ivfreader/ivfreader.go

View check run for this annotation

Codecov / codecov/patch

pkg/media/ivfreader/ivfreader.go#L76-L77

Added lines #L76 - L77 were not covered by tests
reader.timebaseDenominator = header.TimebaseDenominator
reader.timebaseNumerator = header.TimebaseNumerator

Expand Down

0 comments on commit 803fd08

Please sign in to comment.