Skip to content

Commit

Permalink
improve quota checks
Browse files Browse the repository at this point in the history
  • Loading branch information
qmuntal committed May 12, 2019
1 parent eba907e commit 440f891
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions decoder.go
Expand Up @@ -94,15 +94,15 @@ func (d *Decoder) Decode(doc *Document) error {
func (d *Decoder) validateDocumentQuotas(doc *Document, isBinary bool) error {
var externalCount int
var allocs int
for i, b := range doc.Buffers {
if i == 0 && isBinary {
continue
}
for _, b := range doc.Buffers {
allocs += int(b.ByteLength)
if !b.IsEmbeddedResource() {
externalCount++
allocs += int(b.ByteLength)
}
}
if isBinary {
externalCount--
}
if externalCount > d.MaxExternalBufferCount {
return errors.New("gltf: External buffer count quota exceeded")
}
Expand Down

0 comments on commit 440f891

Please sign in to comment.