PotreeConverter icon indicating copy to clipboard operation
PotreeConverter copied to clipboard

Potential bug in indexer code

Open rhuitl opened this issue 1 year ago • 0 comments

In https://github.com/potree/PotreeConverter/blob/develop/Converter/src/indexer.cpp#L1165, the members of min, which are of type int32, are assigned the maximum value for an int64. This results in an implicit conversion to -1, breaking the following logic that is supposed to determine the minimum values. I think it's going to be stuck at -1 for clouds that don't have any values less than that.

Clang warns about this:

warning: implicit conversion from 'std::numeric_limits<long long>::type' (aka 'long long') to 'int32_t' (aka 'int') changes value from 9223372036854775807 to -1

The problem is that when I fix this issue by changing the Int64_t to int32_t, it solves the compiler warning. However, when Brotli compression is used, it will lead to a corrupt output cloud - in the viewer it looks like the point coordinates are shifted outside their node boxes.

I can try to come up with a way to reproduce this, but maybe the description is sufficient to figure out what's going on.

rhuitl avatar Aug 05 '23 23:08 rhuitl