sandialabs / InterSpec

spectral radiation analysis software
https://sandialabs.github.io/InterSpec
GNU Lesser General Public License v2.1
129 stars 21 forks source link

Freeze on unusual input in nuclide selection dialog #19

Open manevich opened 1 year ago

manevich commented 1 year ago

InterSpec freezes on unusual input in nuclide selection dialog.

Steps to repeat:

  1. Enter menu "Tools > Nuclide Decay Info"
  2. Press "Add Nuclide"
  3. Type "Co6+"

Not limited to "Co6+" string. Any part of valid nuclide name with at least one digit and "+" or "*" char afterwards makes InterSpec freeze.

I'm using InterSpec v1.0.10 buid date 20220808 on Debian Linux.

wcjohns commented 1 year ago

Thank you very much for reporting this!

I wont have access to my Linux computer for about a week, and I cant reproduce on Windows/macOS, so it will be a little bit until it is fixed.

There is a regular expression used for highlighting the suggested nuclides list, based on your input, so perhaps special regex character are somehow confusing things and causing this issue. There are a number of workarounds in the IsotopeNameFilterModel::nuclideNameMatcherJs() function, which defines this javascript regex, so I will look there first.

LaurentCronimus commented 1 year ago

Hi, I have the same problem with InterSpec v1.0.11 buid date 20221017 on W10 64.

wcjohns commented 1 year ago

Thank you for the additional input @LaurentCronimus. I took a look at this, and had a really hard time consistently reproducing it; the error didn't seem to often happen. So I think I'll just re-write the relevant code to do the validation in C++ instead of javascript.