[GH-ISSUE #366] Weakness in Set header and footer that can lead to crash #290

Closed
opened 2026-05-05 12:06:24 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @gabrielaexile on GitHub (Feb 22, 2022).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/366

Originally assigned to: @jmcnamara on GitHub.

Hello

Setting header or footer generates error then it will call free(self->footer); in various of places. But it will not set it to NULL, which will cause problem when you come to lxw_worksheet_free where it will again free the footer and header which now are invalid pointers.

Originally created by @gabrielaexile on GitHub (Feb 22, 2022). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/366 Originally assigned to: @jmcnamara on GitHub. Hello Setting header or footer generates error then it will call **free(self->footer);** in various of places. But it will not set it to NULL, which will cause problem when you come to lxw_worksheet_free where it will again free the footer and header which now are invalid pointers.
gitea-mirror 2026-05-05 12:06:24 -06:00
Author
Owner

@jmcnamara commented on GitHub (Feb 22, 2022):

Thanks, that looks like a bug. I'll look into it.

<!-- gh-comment-id:1047323321 --> @jmcnamara commented on GitHub (Feb 22, 2022): Thanks, that looks like a bug. I'll look into it.
Author
Owner

@jmcnamara commented on GitHub (Feb 22, 2022):

I've pushed a fix for this to main if you care to try it out.

There is a failing Windows compilation test but I don't think that it is related. I am debugging it.

<!-- gh-comment-id:1048089489 --> @jmcnamara commented on GitHub (Feb 22, 2022): I've pushed a fix for this to main if you care to try it out. There is a failing Windows compilation test but I don't think that it is related. I am debugging it.
Author
Owner

@jmcnamara commented on GitHub (Feb 23, 2022):

The failing test is related so I'll need to look at this a bit more.

<!-- gh-comment-id:1048580038 --> @jmcnamara commented on GitHub (Feb 23, 2022): The failing test is related so I'll need to look at this a bit more.
Author
Owner

@jmcnamara commented on GitHub (Feb 23, 2022):

I fixed the Windows issue, it was in the test case and not the code. I also did a bit more refactoring to take care of some other edge cases in the header/footer failure modes.

Anyway, let me know if this resolves your issue. I will close the GitHub issue in a few days if there is no update.

<!-- gh-comment-id:1048972690 --> @jmcnamara commented on GitHub (Feb 23, 2022): I fixed the Windows issue, it was in the test case and not the code. I also did a bit more refactoring to take care of some other edge cases in the header/footer failure modes. Anyway, let me know if this resolves your issue. I will close the GitHub issue in a few days if there is no update.
Author
Owner

@jmcnamara commented on GitHub (Feb 25, 2022):

Closing. If there are any further issues let me know.

<!-- gh-comment-id:1050695311 --> @jmcnamara commented on GitHub (Feb 25, 2022): Closing. If there are any further issues let me know.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/libxlsxwriter#290
No description provided.