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: