Page MenuHomePhabricator

Parsing of DICOM-tags is locale-dependent
Closed, ResolvedPublic

Description

With the changes made in bug-19485, some DICOM-tags are now parsed to double using the std::stod instead of the slower stringstreams that were used before.

However, there is a difference between these two implementations:
stringstreams seem to be locale-independent, which stod definitely isn't.

The code that surrounds the parsing does not set the locale, so the developer has to make sure the correct locale is set.

This should be fixed to prevent erronously parsed dicom-tags.

Instead of reverting to the slow stringstreams, I would recommend the use of the locale-independent DCMTK implementation of atof.

As far as I can see, the results are correct and it's even faster than stod.

Event Timeline

User engelm has pushed new remote branch:

bug-19636-fix-locale-error-in-dicom-parsing

Looks good. I think we can merge it into the master. Thank you.

[619208]: Merge branch 'bug-19636-fix-locale-error-in-dicom-parsing'

Merged commits:

2016-03-29 13:28:34 Markus Engel [fc6494]
using locale independent implementation by DCMTK