Commit c347ec4
committed
WellConnections: bound the Cartesian->compressed lookup
WellConnections::init translates each well connection into a compressed cell
index with
cart_grid_idx = i + nx*(j + ny*k);
compressed_idx = cartesian_to_compressed[cart_grid_idx];
and does the same for possibleFutureConnections. Neither lookup checked that
the computed position is inside cartesian_to_compressed before indexing it.
The map is sized by the level-zero Cartesian grid, and a connection is not
obliged to carry a position in that grid -- a completion inside a local grid
refinement, for instance, carries a position local to the refined grid. When
that position lands past the end of the map the result is an out-of-bounds read
during load balancing.
Route both lookups through a helper that returns -1 for a position outside the
map, which the existing "ignore inactive cells" test already handles. Nothing
changes for a position that was in range, so grids whose connections all
address level zero are unaffected.1 parent e94a738 commit c347ec4
1 file changed
Lines changed: 18 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
118 | 134 | | |
119 | 135 | | |
120 | 136 | | |
| |||
126 | 142 | | |
127 | 143 | | |
128 | 144 | | |
129 | | - | |
| 145 | + | |
130 | 146 | | |
131 | 147 | | |
132 | 148 | | |
| |||
135 | 151 | | |
136 | 152 | | |
137 | 153 | | |
138 | | - | |
| 154 | + | |
139 | 155 | | |
140 | 156 | | |
141 | 157 | | |
| |||
0 commit comments