pixelbender / go-matroska Goto Github PK
View Code? Open in Web Editor NEWGolang: Matroska and WebM Format
License: MIT License
Golang: Matroska and WebM Format
License: MIT License
After install and redme example have error
src/github.com/pixelbender/go-matroska/ebml/decode.go:172: dec.buf.Discard undefined (type *bufio.Reader has no field or method Truncate) src/github.com/pixelbender/go-matroska/ebml/decode.go:197: dec.buf.Discard undefined (type *bufio.Reader has no field or method Truncate) src/github.com/pixelbender/go-matroska/ebml/decode.go:225: dec.buf.Discard undefined (type *bufio.Reader has no field or method Discard) src/github.com/pixelbender/go-matroska/ebml/decode.go:313: dec.buf.Discard undefined (type *bufio.Reader has no field or method Truncate)
go version go1.3.3 linux/arm
it is possible to crash the document parser with an out of memory
if io.Reader
is corrupt. this is particularly problematic when handling user-supplied data (data streamed a socket for example). a user sending a specially crafted sequence of bytes will crash the go process because because the decoder naively allocates buffers of an arbitrary size:
182: }
183:
184: // GetElementContent returns the element's data (if any)
185: // Data is present if the element's type is not Master
186: func (doc *Document) GetElementContent(el *Element) ([]byte, error) {
=> 187: buf := make([]byte, el.Size)
188:
189: _, err := io.ReadFull(doc.r, buf)
190: if err != nil {
191: return nil, err
192: }
(dlv) p el.Size
29055659576
The above condition leads to the following crash attempting to allocate 29GB of memory:
fatal error: runtime: out of memory
a simple solution would be to use a fixed buffer and refuse to process an element that is larger than the fixed buffer:
if el.Size > len(self.buffer) {
return nil, errors.New("invalid size")
}
Thanks for the great work of crafting matroska format parser for golang.
The library is currently used to verify MediaRecorder from our team.
Now, I'm adding test for verifying whether the result mkv from MediaRecorder is muted.
Just curious about whether the library support examining the content of simple block of audio track.
I saw the information parsed from library can identify those audio blocks but the data field here:
go-matroska/matroska/matroska.go
Line 137 in 7953d3f
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.