From 3691b53ddea5359f59648e71f0167b6343475029 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Mon, 19 Feb 2024 12:54:51 -0500 Subject: [PATCH] Was given a use case by Carsten Wulff (github issue #289) that fails in the bplane code for subcell binning. It is still not clear why this example causes a failure when the bplane code has been working for so long. However, simply checking for the BT_ARRAY bit at one additional point in the code prevents the crash condition and appears not to have caused any issue with the database. --- VERSION | 2 +- bplane/bpBins.c | 3 +++ bplane/bpEnum.h | 2 +- bplane/bpMain.c | 2 +- bplane/bpOpaque.h | 6 +++--- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/VERSION b/VERSION index c0cbfb0d..019cb7bc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -8.3.461 +8.3.462 diff --git a/bplane/bpBins.c b/bplane/bpBins.c index 594984de..54f355a9 100644 --- a/bplane/bpBins.c +++ b/bplane/bpBins.c @@ -567,6 +567,9 @@ BinArray *bpBinArrayBuild(Rect bbox, int numBins; int count; + /* Added by Tim, 2/19/2024 */ + /* This line is not supposed to be needed? */ + if ((!subbin) && ((int)elements & BT_ARRAY)) return NULL; if(BPD) DumpRect("#### bpBinArrayBuild, TOP bbox= ", &bbox); diff --git a/bplane/bpEnum.h b/bplane/bpEnum.h index d1535635..5cb7fbfa 100644 --- a/bplane/bpEnum.h +++ b/bplane/bpEnum.h @@ -305,7 +305,7 @@ bpEnumNextBin(BPEnum *bpe, bool inside) { BPStack *bps = bpe->bpe_top; -#ifdef PARANOID +#ifdef BPARANOID ASSERT(bps,"bpEnumNextBin"); ASSERT(!bpe->bpe_nextElement,"bpEnumNextBin"); #endif diff --git a/bplane/bpMain.c b/bplane/bpMain.c index 4cfc6192..b3cd752d 100644 --- a/bplane/bpMain.c +++ b/bplane/bpMain.c @@ -128,7 +128,7 @@ void BPAdd(BPlane *bp, void *element) "BPAdd, attempted during active enumerations"); /* element rect must be canonical! */ -#ifdef PARANOID +#ifdef BPARANOID ASSERT(GeoIsCanonicalRect(r),"BPAdd, rect must be canonical."); #endif diff --git a/bplane/bpOpaque.h b/bplane/bpOpaque.h index c92b3a60..c1796aec 100644 --- a/bplane/bpOpaque.h +++ b/bplane/bpOpaque.h @@ -106,7 +106,7 @@ static __inline__ bool bpBinType(BinArray *ba, int i) static __inline__ Element *bpBinList(BinArray *ba, int i) { -#ifdef PARANOID +#ifdef BPARANOID ASSERT(bpBinType(ba,i)==BT_LIST,"bpBinList"); #endif return (Element *) ba->ba_bins[i]; @@ -114,7 +114,7 @@ static __inline__ Element *bpBinList(BinArray *ba, int i) static __inline__ Element **bpBinListHead(BinArray *ba, int i) { -#ifdef PARANOID +#ifdef BPARANOID ASSERT(bpBinType(ba,i)==BT_LIST,"bpBinList"); #endif return (Element **) &ba->ba_bins[i]; @@ -122,7 +122,7 @@ static __inline__ Element **bpBinListHead(BinArray *ba, int i) static __inline__ BinArray *bpSubArray(BinArray *ba, int i) { -#ifdef PARANOID +#ifdef BPARANOID ASSERT(bpBinType(ba,i)==BT_ARRAY,"bpSubArray"); #endif return (BinArray *) ((pointertype) ba->ba_bins[i] & ~BT_TYPE_MASK);