Bug/Crash in internal PDF import when selecting highest precision

Summary:

Selecting the highest precision in the internal PDF import dialog causes an out-of-bounds access which may crash Inkscape.

Steps to reproduce the bug:

  • open a PDF in/using Inkscape
  • move precision slider to the highest/right-most value
  • the label below ("very fine") disappears

Steps to reproduce the crash:

  • open a PDF file in Inkscape using the internal PDF import dialog
  • without closing Inkscape, follow the steps above, i.e.:
    • open another PDF file to open the internal import dialog
    • move precision slider to the highest/right-most value
    • Inkscape crashes

Cause of the bug

Debugging the crash lead me to this function: PdfImportDialog::_onPrecisionChanged

When value is equal to max, comment_idx will be 4, which is beyond the length of labels and causes an out-of-bounds access.

Version info

Inkscape 1.3.2 (091e20ef0f, 2023-11-25, custom)

    GLib version:     2.78.3
    GTK version:      3.24.39
    glibmm version:   2.66.6
    gtkmm version:    3.24.8
    libxml2 version:  2.12.3
    libxslt version:  1.1.39
    Cairo version:    1.18.0
    Pango version:    1.51.0
    HarfBuzz version: 8.3.0

    OS version:       Arch Linux