osmbuildings/building code: Fix buffer overflows in the sphere code


The sphere code overflowed the arrays since it reallocated
based on:
 sphereVertexCount = sphereStackCount * (sphereSectorCount + 1);
and then looped over:

  for (stackIndex = 0; stackIndex <=sphereStackCount; ...)
    for (sectorIndex = 0; sectorIndex <= sphereSectorCount; ...)

Fix the vertex count to be:
 (sphereStackCount + 1) * (sphereSectorCount + 1)
and calculate the index count correct (it writes only one triple for
the first/last stack).

Pick-to: 6.12 6.11 6.8
Change-Id: I6882d3faa5f560051967de6672dea030bfb0d267
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
commit68bfb910c991e9c831eccd668230e35d034b5959
parent2d0582ed690583213e1c5b950e27a5441158f416
authorFriedemann Kleint <Friedemann.Kleint@qt.io>
committerFriedemann Kleint <Friedemann.Kleint@qt.io>
commit timeWed, 24 Jun 2026 04:48:46 +0000