-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
100% cpu with wrong date cell #974
Comments
time.Time holds seconds since Jan 1 year 1885 with uint64, whose maximum value is It means the max days count is obviously:
In another word, unlimited time.Add will cause If excelize can check it before |
Thanks for your feedback, I have fixed it, please try to use the master branch code, and this patch will be released in the next version. |
Thanks for your work. |
@eaglexiang 这些日期格式的身份证,是不是WPS来的?我们在业务里也遇到了,很怀疑是WPS做了什么“优化”。 就算这样解决了CPU占用的问题,也还是没拿到身份证原文吧。 |
我们处理的文件来自客户,并不清楚他们使用什么工具编辑这些文件。不过我在这个 issue 里有说复现方式。
现在是可以拿到的。 |
以 |
刚刚验证了一下,你是对的,的确存在这个问题。但是这个恐怕无法通过 excelize 来解决,除非 excelize 能提供一个绕过格式解析,直接获取单元格原始值的方法 @xuri |
The excel will display f, err := excelize.OpenFile("Book1.xlsx")
if err != nil {
fmt.Println(err)
return
}
styleID, err := f.NewStyle(&excelize.Style{NumFmt: 1})
if err != nil {
fmt.Println(err)
}
if err := f.SetCellStyle("Sheet1", "A1", "A1", styleID); err != nil {
fmt.Println(err)
} |
- Escape XML character in the drop list - Fix incorrect character count limit in the drop list - Fix Excel time parse issue in some case - Fix custom number format month parse issue in some case - Fix corrupted file generated caused by concurrency adding pictures
We are handling excel files uploaded by customers every day, I mean those excel files are created by customers on net.
Lately we found wrong date-style cell may cause 100% cpu issue.
steps to reproduce:
500123199005132245
Rows.Columns()
of excelizeProgram will hang up because of countless
time.Add
, id-card number(500123199005132245
) will be handled as days count.I found a block about date in ECMA-376.
It may be right in ECMA-376 but danger in production environments. Stream Reader(Rows) is needed considering large file size and we cannot find a way to avoid the performance issue.
The text was updated successfully, but these errors were encountered: