jmcnamara / libxlsxwriter

A C library for creating Excel XLSX files.
https://libxlsxwriter.github.io
Other
1.49k stars 332 forks source link

add some calloc memory checks #345

Closed squinky86 closed 3 years ago

squinky86 commented 3 years ago

I was playing with the chart features and ran across some unchecked callocs. In the unlikely event that the allocation(s) fail, they would cause some null dereferences.

jmcnamara commented 3 years ago

While this could prevent a segfault it could also potentially create a corrupt Excel file. Of the two the segfault is the lesser of the two evils, for me.

I could implement a more graceful handling of malloc failures at the file writing level but it would would require a major refactoring.

So for now I'll pass on this solution.