Bug in PropertyT<bool> restore function
Hi there, I stumbled across a pretty infuriating bug in OpenMesh 8.0 (I think it still might exist in 8.1) in the `restore` function for `PropertyT<bool>` (`Property.hh`) (though this issue may exist elsewhere quite possibly...). The issue occurs at the beginning of the for loop where the bit packing happens (around line 313). The problematic statement is `_istr >> bits;` The problem is `std::istream` by default skips white space characters (https://en.cppreference.com/w/cpp/io/manip/skipws), so if one of the bytes in the stream being restored happens to be 0x20 (32 - 'space' character), it will be skipped, leading to the stream getting out of sync with the bytes read (I was able to track this down using lots of `_is.tellg();` calls). I've made a minimal change in Property.hh to ensure white space characters aren't skipped: `_istr >> std::noskipws;` right before the for loop. There might be a better more central place to enable this setting but it resolves the bug for us for now. If anyone has any feedback on the best place for this fix I'd love to know! Thanks! Tom
participants (1)
-
hultonha@amazon.co.uk