37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
|
|
From a47d7130bcbf6dbf2c3d0cb33555a68e288cc407 Mon Sep 17 00:00:00 2001
|
||
|
|
From: "D. Richard Hipp" <drh@hwaci.com>
|
||
|
|
Date: Fri, 18 Jan 2019 18:52:17 +0000
|
||
|
|
Subject: [PATCH 0794/1009] Avoid integer overflow when computing the array of
|
||
|
|
a bounding box with the rtree_i32 virtual table.
|
||
|
|
|
||
|
|
https://github.com/mackyle/sqlite/commit/a47d7130bcbf6dbf2c3d0cb33555a68e288cc407
|
||
|
|
|
||
|
|
---
|
||
|
|
ext/rtree/rtree.c | 10 +++++-----
|
||
|
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/ext/rtree/rtree.c b/ext/rtree/rtree.c
|
||
|
|
index c998d95..73d0661 100644
|
||
|
|
--- a/ext/rtree/rtree.c
|
||
|
|
+++ b/ext/rtree/rtree.c
|
||
|
|
@@ -1999,11 +1999,11 @@ static RtreeDValue cellArea(Rtree *pRtree, RtreeCell *p){
|
||
|
|
#endif
|
||
|
|
{
|
||
|
|
switch( pRtree->nDim ){
|
||
|
|
- case 5: area = p->aCoord[9].i - p->aCoord[8].i;
|
||
|
|
- case 4: area *= p->aCoord[7].i - p->aCoord[6].i;
|
||
|
|
- case 3: area *= p->aCoord[5].i - p->aCoord[4].i;
|
||
|
|
- case 2: area *= p->aCoord[3].i - p->aCoord[2].i;
|
||
|
|
- default: area *= p->aCoord[1].i - p->aCoord[0].i;
|
||
|
|
+ case 5: area = (i64)p->aCoord[9].i - (i64)p->aCoord[8].i;
|
||
|
|
+ case 4: area *= (i64)p->aCoord[7].i - (i64)p->aCoord[6].i;
|
||
|
|
+ case 3: area *= (i64)p->aCoord[5].i - (i64)p->aCoord[4].i;
|
||
|
|
+ case 2: area *= (i64)p->aCoord[3].i - (i64)p->aCoord[2].i;
|
||
|
|
+ default: area *= (i64)p->aCoord[1].i - (i64)p->aCoord[0].i;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return area;
|
||
|
|
--
|
||
|
|
1.8.3.1
|
||
|
|
|