[chore]: Bump github.com/abema/go-mp4 from 1.0.0 to 1.1.1 (#2257)

Bumps [github.com/abema/go-mp4](https://github.com/abema/go-mp4) from 1.0.0 to 1.1.1.
- [Release notes](https://github.com/abema/go-mp4/releases)
- [Commits](https://github.com/abema/go-mp4/compare/v1.0.0...v1.1.1)

---
updated-dependencies:
- dependency-name: github.com/abema/go-mp4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2023-10-09 10:13:37 +02:00 committed by GitHub
parent 5aeceb5ff7
commit abd598e8f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 81 additions and 11 deletions

2
go.mod
View file

@ -18,7 +18,7 @@ require (
codeberg.org/gruf/go-store/v2 v2.2.2 codeberg.org/gruf/go-store/v2 v2.2.2
github.com/DmitriyVTitov/size v1.5.0 github.com/DmitriyVTitov/size v1.5.0
github.com/KimMachineGun/automemlimit v0.3.0 github.com/KimMachineGun/automemlimit v0.3.0
github.com/abema/go-mp4 v1.0.0 github.com/abema/go-mp4 v1.1.1
github.com/buckket/go-blurhash v1.1.0 github.com/buckket/go-blurhash v1.1.0
github.com/coreos/go-oidc/v3 v3.6.0 github.com/coreos/go-oidc/v3 v3.6.0
github.com/disintegration/imaging v1.6.2 github.com/disintegration/imaging v1.6.2

4
go.sum
View file

@ -91,8 +91,8 @@ github.com/DmitriyVTitov/size v1.5.0 h1:/PzqxYrOyOUX1BXj6J9OuVRVGe+66VL4D9FlUaW5
github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0= github.com/DmitriyVTitov/size v1.5.0/go.mod h1:le6rNI4CoLQV1b9gzp1+3d7hMAD/uu2QcJ+aYbNgiU0=
github.com/KimMachineGun/automemlimit v0.3.0 h1:khgwM5ESVN85cE6Bq2ozMAAWDfrOEwQ51D/YlmThE04= github.com/KimMachineGun/automemlimit v0.3.0 h1:khgwM5ESVN85cE6Bq2ozMAAWDfrOEwQ51D/YlmThE04=
github.com/KimMachineGun/automemlimit v0.3.0/go.mod h1:pJhTW/nWJMj6SnWSU2TEKSlCaM+1N5Mej+IfS/5/Ol0= github.com/KimMachineGun/automemlimit v0.3.0/go.mod h1:pJhTW/nWJMj6SnWSU2TEKSlCaM+1N5Mej+IfS/5/Ol0=
github.com/abema/go-mp4 v1.0.0 h1:SvfJv+fi2Bpa1uInouqIYpEUFN3yyYCQMXlf4ijOHf0= github.com/abema/go-mp4 v1.1.1 h1:OfzkdMO6SWTBR1ltNSVwlTHatrAK9I3iYLQfkdEMMuc=
github.com/abema/go-mp4 v1.0.0/go.mod h1:vPl9t5ZK7K0x68jh12/+ECWBCXoWuIDtNgPtU2f04ws= github.com/abema/go-mp4 v1.1.1/go.mod h1:vPl9t5ZK7K0x68jh12/+ECWBCXoWuIDtNgPtU2f04ws=
github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU= github.com/ajg/form v1.5.1 h1:t9c7v8JUKu/XxOGBU0yjNpaMloxGEJhUkqFRq0ibGeU=
github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY=
github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=

View file

@ -3,6 +3,7 @@
import ( import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt"
"io" "io"
"math" "math"
) )
@ -128,7 +129,6 @@ func ReadBoxInfo(r io.ReadSeeker) (*BoxInfo, error) {
if _, err := bi.SeekToPayload(r); err != nil { if _, err := bi.SeekToPayload(r); err != nil {
return nil, err return nil, err
} }
} else if bi.Size == 1 { } else if bi.Size == 1 {
// read more 8 bytes // read more 8 bytes
buf.Reset() buf.Reset()
@ -139,6 +139,10 @@ func ReadBoxInfo(r io.ReadSeeker) (*BoxInfo, error) {
bi.Size = binary.BigEndian.Uint64(buf.Bytes()) bi.Size = binary.BigEndian.Uint64(buf.Bytes())
} }
if bi.Size == 0 {
return nil, fmt.Errorf("invalid size")
}
return bi, nil return bi, nil
} }

View file

@ -0,0 +1,36 @@
package mp4
/*************************** ac-3 ****************************/
// https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf
func BoxTypeAC3() BoxType { return StrToBoxType("ac-3") }
func init() {
AddAnyTypeBoxDef(&AudioSampleEntry{}, BoxTypeAC3())
}
/*************************** dac3 ****************************/
// https://www.etsi.org/deliver/etsi_ts/102300_102399/102366/01.04.01_60/ts_102366v010401p.pdf
func BoxTypeDAC3() BoxType { return StrToBoxType("dac3") }
func init() {
AddBoxDef(&Dac3{})
}
type Dac3 struct {
Box
Fscod uint8 `mp4:"0,size=2"`
Bsid uint8 `mp4:"1,size=5"`
Bsmod uint8 `mp4:"2,size=3"`
Acmod uint8 `mp4:"3,size=3"`
LfeOn uint8 `mp4:"4,size=1"`
BitRateCode uint8 `mp4:"5,size=5"`
Reserved uint8 `mp4:"6,size=5,const=0"`
}
func (Dac3) GetType() BoxType {
return BoxTypeDAC3()
}

View file

@ -638,6 +638,10 @@ func (hdlr *Hdlr) OnReadName(r bitio.ReadSeeker, leftBits uint64, ctx Context) (
return 0, true, nil return 0, true, nil
} }
if !readerHasSize(r, size) {
return 0, false, fmt.Errorf("not enough bits")
}
buf := make([]byte, size) buf := make([]byte, size)
if _, err := io.ReadFull(r, buf); err != nil { if _, err := io.ReadFull(r, buf); err != nil {
return 0, false, err return 0, false, err
@ -1197,6 +1201,7 @@ func (*Saiz) GetType() BoxType {
/*********************** SampleEntry *************************/ /*********************** SampleEntry *************************/
func BoxTypeMp4v() BoxType { return StrToBoxType("mp4v") }
func BoxTypeAvc1() BoxType { return StrToBoxType("avc1") } func BoxTypeAvc1() BoxType { return StrToBoxType("avc1") }
func BoxTypeEncv() BoxType { return StrToBoxType("encv") } func BoxTypeEncv() BoxType { return StrToBoxType("encv") }
func BoxTypeHev1() BoxType { return StrToBoxType("hev1") } func BoxTypeHev1() BoxType { return StrToBoxType("hev1") }
@ -1207,6 +1212,7 @@ func BoxTypeAvcC() BoxType { return StrToBoxType("avcC") }
func BoxTypePasp() BoxType { return StrToBoxType("pasp") } func BoxTypePasp() BoxType { return StrToBoxType("pasp") }
func init() { func init() {
AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeMp4v())
AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeAvc1()) AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeAvc1())
AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeEncv()) AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeEncv())
AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeHev1()) AddAnyTypeBoxDef(&VisualSampleEntry{}, BoxTypeHev1())

View file

@ -17,6 +17,29 @@
var ErrUnsupportedBoxVersion = errors.New("unsupported box version") var ErrUnsupportedBoxVersion = errors.New("unsupported box version")
func readerHasSize(reader bitio.ReadSeeker, size uint64) bool {
pre, err := reader.Seek(0, io.SeekCurrent)
if err != nil {
return false
}
end, err := reader.Seek(0, io.SeekEnd)
if err != nil {
return false
}
if uint64(end-pre) < size {
return false
}
_, err = reader.Seek(pre, io.SeekStart)
if err != nil {
return false
}
return true
}
type marshaller struct { type marshaller struct {
writer bitio.Writer writer bitio.Writer
wbits uint64 wbits uint64
@ -417,12 +440,13 @@ func (u *unmarshaller) unmarshalSlice(v reflect.Value, fi *fieldInstance) error
} }
} }
if length > math.MaxInt32 { if u.rbits%8 == 0 && elemType.Kind() == reflect.Uint8 && fi.size == 8 {
return fmt.Errorf("out of memory: requestedSize=%d", length)
}
if fi.size != 0 && fi.size%8 == 0 && u.rbits%8 == 0 && elemType.Kind() == reflect.Uint8 && fi.size == 8 {
totalSize := length * uint64(fi.size) / 8 totalSize := length * uint64(fi.size) / 8
if !readerHasSize(u.reader, totalSize) {
return fmt.Errorf("not enough bits")
}
buf := bytes.NewBuffer(make([]byte, 0, totalSize)) buf := bytes.NewBuffer(make([]byte, 0, totalSize))
if _, err := io.CopyN(buf, u.reader, int64(totalSize)); err != nil { if _, err := io.CopyN(buf, u.reader, int64(totalSize)); err != nil {
return err return err
@ -431,7 +455,7 @@ func (u *unmarshaller) unmarshalSlice(v reflect.Value, fi *fieldInstance) error
u.rbits += uint64(totalSize) * 8 u.rbits += uint64(totalSize) * 8
} else { } else {
slice = reflect.MakeSlice(v.Type(), 0, int(length)) slice = reflect.MakeSlice(v.Type(), 0, 0)
for i := 0; ; i++ { for i := 0; ; i++ {
if fi.length != LengthUnlimited && uint(i) >= fi.length { if fi.length != LengthUnlimited && uint(i) >= fi.length {
break break

2
vendor/modules.txt vendored
View file

@ -77,7 +77,7 @@ github.com/DmitriyVTitov/size
## explicit; go 1.19 ## explicit; go 1.19
github.com/KimMachineGun/automemlimit github.com/KimMachineGun/automemlimit
github.com/KimMachineGun/automemlimit/memlimit github.com/KimMachineGun/automemlimit/memlimit
# github.com/abema/go-mp4 v1.0.0 # github.com/abema/go-mp4 v1.1.1
## explicit; go 1.14 ## explicit; go 1.14
github.com/abema/go-mp4 github.com/abema/go-mp4
github.com/abema/go-mp4/internal/bitio github.com/abema/go-mp4/internal/bitio