[GH-ISSUE #459] Read overflows causing corruption, and performance issues #359

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

Originally created by @znakeeye on GitHub (Oct 23, 2024).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/459

Please check utility.c. There you find several of these dangerous loops:

while (p && some_operation_here)
    p++;

It should be *p in all cases. E.g. See lxw_name_to_row_2 where parsing "A1" would increment p like 1,000,000 times with some bad luck. Thus, we have a read overflow.

Fix:

  1. Replace all if (p) with if (*p)
  2. Replace all while (p with while (*p
Originally created by @znakeeye on GitHub (Oct 23, 2024). Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/459 Please check `utility.c`. There you find several of these **dangerous** loops: ```c while (p && some_operation_here) p++; ``` It should be `*p` in all cases. E.g. See `lxw_name_to_row_2` where parsing "A1" would increment `p` like 1,000,000 times with some bad luck. Thus, we have a read overflow. **Fix:** 1. Replace all `if (p)` with `if (*p)` 2. Replace all `while (p` with `while (*p`
Author
Owner

@jmcnamara commented on GitHub (Oct 24, 2024):

Thanks for the report. Fixed on main.

<!-- gh-comment-id:2436126036 --> @jmcnamara commented on GitHub (Oct 24, 2024): Thanks for the report. Fixed on main.
Author
Owner

@znakeeye commented on GitHub (Oct 24, 2024):

Thanks. Any plans for an official 1.1.9 release?

<!-- gh-comment-id:2436147112 --> @znakeeye commented on GitHub (Oct 24, 2024): Thanks. Any plans for an official 1.1.9 release?
Author
Owner

@jmcnamara commented on GitHub (Oct 24, 2024):

If you need one just for this I can do one. Let me know.

<!-- gh-comment-id:2436176403 --> @jmcnamara commented on GitHub (Oct 24, 2024): If you need one just for this I can do one. Let me know.
Author
Owner

@znakeeye commented on GitHub (Oct 24, 2024):

Yes please. Maintaining local patches is not great 🙂

<!-- gh-comment-id:2436184952 --> @znakeeye commented on GitHub (Oct 24, 2024): Yes please. Maintaining local patches is not great 🙂
Author
Owner

@jmcnamara commented on GitHub (Oct 24, 2024):

The changes are upstream in v1.1.9. Thanks.

<!-- gh-comment-id:2436476176 --> @jmcnamara commented on GitHub (Oct 24, 2024): The changes are upstream in v1.1.9. Thanks.
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#359
No description provided.