richardlehane / mscfb Goto Github PK
View Code? Open in Web Editor NEWgolang reader for the Microsoft Compound File Binary File format
License: Apache License 2.0
golang reader for the Microsoft Compound File Binary File format
License: Apache License 2.0
A file in the govdocs corpus triggers a traversal bug that blows the stack. Reported by @euanc
runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow
runtime stack:
runtime.throw(0x84c044, 0xe)
/home/travis/.gimme/versions/go1.12.9.linux.amd64/src/runtime/panic.go:617 +0x72
runtime.newstack()
/home/travis/.gimme/versions/go1.12.9.linux.amd64/src/runtime/stack.go:1041 +0x6f0
runtime.morestack()
/home/travis/.gimme/versions/go1.12.9.linux.amd64/src/runtime/asm_amd64.s:429 +0x8f
goroutine 10 [running]:
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:150 +0x3fb fp=0xc024000390 sp=0xc024000388 pc=0x6dcfdb
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc024000430 sp=0xc024000390 pc=0x6dcfb5
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc0240004d0 sp=0xc024000430 pc=0x6dcfb5
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc024000570 sp=0xc0240004d0 pc=0x6dcfb5
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc024000610 sp=0xc024000570 pc=0x6dcfb5
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc0240006b0 sp=0xc024000610 pc=0x6dcfb5
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc024000750 sp=0xc0240006b0 pc=0x6dcfb5
github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb.(*Reader).traverse.func1(0x0, 0xbdbcf8, 0x0, 0x0)
/home/travis/gopath/src/github.com/richardlehane/siegfried/vendor/github.com/richardlehane/mscfb/file.go:157 +0x3d5 fp=0xc0240007f0 sp=0xc024000750 pc=0x6dcfb5
Stream IDs are currently mapped directly to indexes into the File slice.
This breaks when directory entry blocks have blank entries and causes sibling traversal to fail.
how to read images from the Compound File?
I'm in the middle of trying to transition some code that I have written in C/C++ over to go and one of the pieces that I have is something that will go into the file and turn off macros in .doc
files so as to make them safer to process in ms word. In order to do this, I merely go into the doc file and flip the length of the micro section to be 0 so that word no longer picks up the macros.
To enable this in go I would need the ability to be able to modify streams. I'm wondering if you would be open to the idea of having File
object allow overwriting (not appending as that sounds much more complicated).
Can you please add a license?
as you code
if entry.Name == "WordDocument" {
fmt.Println(buf[:i])
fmt.Println(string(buf[:i]))
}
will output unknow code ,
I expect output person read string or text
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.