OSDN Git Service

better array management via QSTACKARRAY() macro
authorIvailo Monev <xakepa10@gmail.com>
Wed, 15 Jun 2022 07:10:48 +0000 (07:10 +0000)
committerIvailo Monev <xakepa10@gmail.com>
Wed, 15 Jun 2022 07:19:34 +0000 (07:19 +0000)
I should probably make it public and start using it in Katana to
eliminate a lot of uninitialized memory access bugs

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
src/core/tools/qbytearray.cpp

index 4fef488..7a269ba 100644 (file)
@@ -1840,7 +1840,7 @@ QByteArray &QByteArray::replace(const char *before, int bsize, const char *after
         // the most complex case. We don't want to lose performance by doing repeated
         // copies and reallocs of the string.
         while (index != -1) {
-            uint indices[4096];
+            QSTACKARRAY(uint, indices, 4096);
             uint pos = 0;
             while(pos < 4095) {
                 index = matcher.indexIn(*this, index);