xlsReader icon indicating copy to clipboard operation
xlsReader copied to clipboard

Slice bounds out of range

Open JurisU opened this issue 3 years ago • 1 comments

Version: 0.9.10 Stack trace:

panic: runtime error: slice bounds out of range [:17861] with capacity 3993

goroutine 1 [running]:
github.com/shakinm/xlsReader/xls.(*Workbook).read(0xc000110240, 0xc00012b000, 0xf99, 0xf99, 0xf99, 0x0)
	/Users/juris/Work/golang/pkg/mod/github.com/shakinm/[email protected]/xls/workbook.go:87 +0x159f
github.com/shakinm/xlsReader/xls.readStream(0x1147ae8, 0xc00007a360, 0xc000000f99, 0x1147ae8, 0xc00007a360, 0x0, 0x0, 0x30, 0x28, 0x110b340, ...)
	/Users/juris/Work/golang/pkg/mod/github.com/shakinm/[email protected]/xls/xls.go:84 +0xc8
github.com/shakinm/xlsReader/xls.openCfb(0xe11ab1a1e011cfd0, 0x0, 0x0, 0x9fffe0003003e, 0x6, 0x100000000, 0x100000000, 0x1100001000, 0xffffffff00000001, 0x1200000000, ...)
	/Users/juris/Work/golang/pkg/mod/github.com/shakinm/[email protected]/xls/xls.go:62 +0x22c
github.com/shakinm/xlsReader/xls.OpenFile(0x7ffeefbff919, 0x3c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
	/Users/juris/Work/golang/pkg/mod/github.com/shakinm/[email protected]/xls/xls.go:17 +0x17c
main.main()
	main2.go:28 +0x8f
exit status 2

Died on reading file workbook, err := xls.OpenFile(*filename)

Can read the same file with PHP package phpoffice/phpspreadsheet PHP found 0x31 4 symbols, this package find only 3 and next is 0x6d, but should be 0x31

Input file:
Untitled 5.xls.zip

JurisU avatar Mar 11 '21 06:03 JurisU

This is happening due to improper handling of mini-FAT container streams. Before reading mini-FAT stream, container stream has to be read first (Section 6.1). I fixed it in my fork.

kleeon avatar Feb 21 '23 15:02 kleeon