Fix integer overflow in heightfield sample buffer allocation


numRows * numCols was computed and used for the malloc() size in 32-bit
int arithmetic, so large height maps (e.g. around 65536x65536) could
wrap the product to a small or zero value, allocating a far too small
buffer while the sample-writing loop below still iterates the true
dimensions, causing a heap buffer overflow.

Store the samples in a std::vector<PxHeightFieldSample> instead of a
manually malloc'd/freed buffer: resize()/operator[] compute the byte
offsets in size_t internally, so the multiplication can no longer wrap,
and there's no manual free() (nor the destructor that existed only for
that) to forget on any future edit.

Pick-to: 6.12 6.11 6.8
Change-Id: Ib373baef3a53c1f4b3515d9deb94dafe4106d2a6
Reviewed-by: Kristoffer Skau <kristoffer.skau@qt.io>
commit643ba0db4da80c510be0da0df653ce53a46dd545
parenta8df0c9a7f8fa142cd0b9319d1e0248a89865248
authorJonas Karlsson <jonas.karlsson@qt.io>
committerJonas Karlsson <jonas.karlsson@qt.io>
commit timeWed, 12 Aug 2026 06:24:39 +0000