Skip to content

Commit

Permalink
Merge pull request #211 from Eyevinn/v0.33.2
Browse files Browse the repository at this point in the history
Version 0.33.2
  • Loading branch information
tobbee authored Jan 26, 2023
2 parents 0ef6caf + 44dd8a6 commit a47ab74
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions Versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

| Version | Highlights |
| ------ | ---------- |
| 0.33.2 | Reset parsing of non-complete mdat box to previous behavior |
| 0.33.1 | Fix parsing of HEVC SPS scaling list data present flag |
| 0.33.0 | Support QuickTime meta box. New possibility to disable parsing of specific boxes |
| 0.32.0 | Repo moved to github.com/Eyevinn/mp4ff |
Expand Down
2 changes: 1 addition & 1 deletion mp4/box.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func makebuf(b Box) []byte {
return make([]byte, b.Size()-boxHeaderSize)
}

// readBoxBody - read box body and check length
// readBoxBody reads complete box body. Returns error if not possible
func readBoxBody(r io.Reader, h BoxHeader) ([]byte, error) {
bodyLen := h.Size - uint64(h.Hdrlen)
if bodyLen == 0 {
Expand Down
10 changes: 8 additions & 2 deletions mp4/boxsr.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,14 @@ func DecodeBoxSR(startPos uint64, sr bits.SliceReader) (Box, error) {
if err != nil {
return nil, err
}
if h.Size > uint64(sr.NrRemainingBytes())+uint64(h.Hdrlen) {
return nil, fmt.Errorf("decode box %q, size %d too big", h.Name, h.Size)

maxSize := uint64(sr.NrRemainingBytes()) + uint64(h.Hdrlen)
// In the following, we do not block mdat to allow for the case
// that the first kiloBytes of a file are fetched and parsed to
// get the init part of a file. In the future, a new decode option that
// stops before the mdat starts is a better alternative.
if h.Size > maxSize && h.Name != "mdat" {
return nil, fmt.Errorf("decode box %q, size %d too big (max %d)", h.Name, h.Size, maxSize)
}

d, ok := decodersSR[h.Name]
Expand Down
5 changes: 4 additions & 1 deletion mp4/mdat.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ func DecodeMdat(hdr BoxHeader, startPos uint64, r io.Reader) (Box, error) {
return &MdatBox{startPos, data, nil, 0, largeSize}, nil
}

// DecodeMdatSR - box-specific decode
// DecodeMdatSR decodes an mdat box
//
// Currently no content and no error is returned if not full length available.
// If not enough content, an accumulated error is stored in sr, though
func DecodeMdatSR(hdr BoxHeader, startPos uint64, sr bits.SliceReader) (Box, error) {
largeSize := hdr.Hdrlen > boxHeaderSize
return &MdatBox{startPos, sr.ReadBytes(hdr.payloadLen()), nil, 0, largeSize}, nil
Expand Down
4 changes: 2 additions & 2 deletions mp4/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
)

var (
commitVersion string = "v0.33.1" // May be updated using build flags
commitDate string = "1674662982" // commitDate in Epoch seconds (may be overridden using build flags)
commitVersion string = "v0.33.2" // May be updated using build flags
commitDate string = "1674682900" // commitDate in Epoch seconds (may be overridden using build flags)
)

// GetVersion - get version and also commitHash and commitDate if inserted via Makefile
Expand Down

0 comments on commit a47ab74

Please sign in to comment.