summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-07-22 03:03:00 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2022-07-22 03:11:18 +0300
commit25900c179cdc963cab207ec821a739a196cf1d29 (patch)
treea1ee89767d6fd8645036cca8d28e34871cf1a708
parent16fe16f3637d111da7885ae26f663d96320944c4 (diff)
SL-17815 Crash at parcelLineFlags
Col ended up negative
-rwxr-xr-xindra/newview/llviewerparceloverlay.cpp15
-rw-r--r--indra/newview/llviewerparceloverlay.h4
2 files changed, 14 insertions, 5 deletions
diff --git a/indra/newview/llviewerparceloverlay.cpp b/indra/newview/llviewerparceloverlay.cpp
index 4d1a7e0ba3..31587549e8 100755
--- a/indra/newview/llviewerparceloverlay.cpp
+++ b/indra/newview/llviewerparceloverlay.cpp
@@ -264,7 +264,7 @@ BOOL LLViewerParcelOverlay::isSoundLocal(const LLVector3& pos) const
{
S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- return PARCEL_SOUND_LOCAL & mOwnership[row * mParcelGridsPerEdge + column];
+ return parcelFlags(row, column, PARCEL_SOUND_LOCAL);
}
U8 LLViewerParcelOverlay::ownership( const LLVector3& pos) const
@@ -278,12 +278,19 @@ U8 LLViewerParcelOverlay::parcelLineFlags(const LLVector3& pos) const
{
S32 row = S32(pos.mV[VY] / PARCEL_GRID_STEP_METERS);
S32 column = S32(pos.mV[VX] / PARCEL_GRID_STEP_METERS);
- return parcelLineFlags(row, column);
+ return parcelFlags(row, column, PARCEL_WEST_LINE | PARCEL_SOUTH_LINE);
}
U8 LLViewerParcelOverlay::parcelLineFlags(S32 row, S32 col) const
{
- U8 flags = PARCEL_WEST_LINE | PARCEL_SOUTH_LINE;
- if (row > mParcelGridsPerEdge || col > mParcelGridsPerEdge)
+ return parcelFlags(row, col, PARCEL_WEST_LINE | PARCEL_SOUTH_LINE);
+}
+
+U8 LLViewerParcelOverlay::parcelFlags(S32 row, S32 col, U8 flags) const
+{
+ if (row >= mParcelGridsPerEdge
+ || col >= mParcelGridsPerEdge
+ || row < 0
+ || col < 0)
{
LL_WARNS() << "Attempted to get ownership out of region's overlay, row: " << row << " col: " << col << LL_ENDL;
return flags;
diff --git a/indra/newview/llviewerparceloverlay.h b/indra/newview/llviewerparceloverlay.h
index 053f69ba4c..c466cc3b6b 100644
--- a/indra/newview/llviewerparceloverlay.h
+++ b/indra/newview/llviewerparceloverlay.h
@@ -88,7 +88,9 @@ private:
// This is in parcel rows and columns, not grid rows and columns
// Stored in bottom three bits.
U8 ownership(S32 row, S32 col) const
- { return 0x7 & mOwnership[row * mParcelGridsPerEdge + col]; }
+ { return parcelFlags(row, col, (U8)0x7); }
+
+ U8 parcelFlags(S32 row, S32 col, U8 flags) const;
void addPropertyLine(std::vector<LLVector3>& vertex_array,
std::vector<LLColor4U>& color_array,