https://bugs.kde.org/show_bug.cgi?id=525585

            Bug ID: 525585
           Summary: kioworker crash in parseOdfBorder when border string
                    contains only a color value
    Classification: Applications
           Product: calligracommon
      Version First unspecified
       Reported In:
          Platform: Arch Linux
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: filters
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

DESCRIPTION
When Dolphin generates a thumbnail for an xlsx file containing cells with 
border definitions that specify only a color (e.g. " #000000") with no 
style or width, kioworker crashes with SIGSEGV.

The bug is in parseOdfBorder() in libs/odf/KoBorder.cpp. If the border 
string contains only a color value, the color is recognized and removed 
via removeLast(), leaving borderData empty. The subsequent call to 
borderData.last() on the now-empty list returns an invalid reference, 
which crashes inside odfBorderStyle() when Qt attempts a string comparison.

STEPS TO REPRODUCE
1. Have an xlsx file with cells using border styles that only specify a color
2. Open the containing folder in Dolphin with thumbnail previews enabled
3. kioworker crashes

OBSERVED RESULT
kioworker crashes with SIGSEGV. Backtrace shows:
#5  QString::compare_helper
#6  KoBorder::odfBorderStyle
#7  parseOdfBorder (KoBorder.cpp line 571)
#8  KoBorder::parseAndSetBorder
#9  KoBorder::loadOdf
#10 KoTableCellStyle::loadOdf

EXPECTED RESULT
Thumbnail is generated without crashing.

PATCH
The fix is to guard the odfBorderStyle call with an isEmpty() check:

    if (!borderData.isEmpty()) {
        const KoBorder::BorderStyle parsedBorderStyle = 
            KoBorder::odfBorderStyle(borderData.last(), &converted);
        if (converted) {
            *hasBorderStyle = true;
            borderData.removeLast();
            *borderStyle = parsedBorderStyle;
        }
    }

A merge request will be submitted with this fix.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 6.7.5
KDE Frameworks Version: 6.30.0
Qt Version: 6.11.2
calligra: 26.08.1-1

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to