Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excelize crash on negative stylng #1432

Closed
liron-l opened this issue Dec 28, 2022 · 0 comments · Fixed by #1433
Closed

excelize crash on negative stylng #1432

liron-l opened this issue Dec 28, 2022 · 0 comments · Fixed by #1433
Labels
bug Something isn't working

Comments

@liron-l
Copy link
Contributor

liron-l commented Dec 28, 2022

Description
formatting.xlsx

Library crash when styling is negative (valid xlsx file attached, opened by any software)

if styleSheet.CellXfs.Xf[s].NumFmtID != nil { <- s is negative
		numFmtID = *styleSheet.CellXfs.Xf[s].NumFmtID
	}

Steps to reproduce the issue:
valid Xslx file attached, can manually create

$ unzip formatting.xlsx
modify xl/worksheets/_rels/sheet1.xml.rels (s="1" -> s="-1")
$ zip -r ../formatting.xlsx *

Describe the results you received:
Library crash

Describe the results you expected:
Library should not crash, should use default formatting

Output of go version:

go version go1.19.2 linux/amd64

Excelize version or commit ID:

2.6.2

Environment details (OS, Microsoft Excel™ version, physical, etc.):
Linux

liron-l added a commit to liron-l/excelize that referenced this issue Dec 28, 2022
Fix qax-os#1432

`formattedValue` can crash if `s` is negative, fixed and add UT.
@xuri xuri added the bug Something isn't working label Dec 28, 2022
xuri pushed a commit to JDavidVR/excelize that referenced this issue Jul 11, 2023
jenbonzhang pushed a commit to jenbonzhang/excelize that referenced this issue Oct 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants