jmcnamara / libxlsxwriter

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

Crash if filename is longer than 31 characters #456

Closed duncangroenewald closed 1 month ago

duncangroenewald commented 1 month ago

Subject: [WARNING]: workbook_add_worksheet(): worksheet name 'xxxxxxxxxxxxxxxxxxxxxx' has error: Worksheet name exceeds Excel's limit of 31 characters.

This results in a crash here on macOS 14 - which shouldn't have any such restriction because MS Excel seems to open files with long filenames without any problems.

/* In optimization mode we don't change dimensions for rows that are */
/* already written. */
if (!ignore_row && !ignore_col && self->optimize) {             <<<<< Crash in self->optimise
    if (row_num < self->optimize_row->row_num)
        return LXW_ERROR_WORKSHEET_INDEX_OUT_OF_RANGE;
}

Been using an earlier version 1.1.5 of the library with no problems.

duncangroenewald commented 1 month ago

OK my bad - I was mistakenly setting the worksheet name to the filename and not reading the error message properly. The error had nothing to do with the filename !