Skip to content

Odf::decodeFormula: fix crash with decimal in formulas

Pierre Ducroquet requested to merge work/ducroquet/fix-sheets-crash into master

Localization::decimalSymbol returns a QString. When not available, "." is used instead. The previous code ran under the assumption that a QString is null-terminated. This is never guaranteed, it happens to be true when initialized from a const char * (like ".") but otherwise it may contain garbage after its size. This made simple formulas like "of:=1.1" crash on my system. Instead of iterating the constData like a null-terminated string, I switched to a C++11 iterator on the QString, making it safer and (IMHO) more readable.

Merge request reports

Loading