QCborValue: fix double-accounting of the usedData when decoding strings
We can only update usedData at the end, after we've decoded all chunks. The update inside the lambda was double-accounting for the first chunk, which could lead to signed integer overflows in usedData. Not unit-testable since the usedData value is not visible in the API. Change-Id: Ibdc95e9af7bd456a94ecfffd16061cc955208859 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>bb10
parent
94b02f6cb2
commit
fdea55cb98
|
|
@ -1561,8 +1561,6 @@ void QCborContainerPrivate::decodeStringFromCbor(QCborStreamReader &reader)
|
|||
if (newSize > MaxByteArraySize)
|
||||
return -1;
|
||||
|
||||
// since usedData <= data.size(), this can't overflow
|
||||
usedData += increment;
|
||||
data.resize(newSize);
|
||||
return offset;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue