patch to guard against bad return numbers

This commit is contained in:
Markus Neteler 2023-02-06 17:56:29 +01:00
parent 308940c460
commit 948f6b0739
1 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,14 @@
diff --git a/io/private/las/Summary.cpp b/io/private/las/Summary.cpp
index e9232d4806..91059bfaf9 100644
--- a/io/private/las/Summary.cpp
+++ b/io/private/las/Summary.cpp
@@ -57,7 +57,8 @@ void Summary::addPoint(double x, double y, double z, int returnNumber)
m_bounds.grow(x, y, z);
// Returns numbers are indexed from one, but the array indexes from 0.
- m_returnCounts[returnNumber - 1]++;
+ if (returnNumber >= 1 && returnNumber <= m_returnCounts.size())
+ m_returnCounts[returnNumber - 1]++;
}