summaryrefslogtreecommitdiffstats
path: root/src/corelib/serialization/qcborstream.cpp
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-20 01:00:13 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-07-20 01:00:13 +0200
commit124b5b8108e181eb4860dd25d88dd641dca32e39 (patch)
treedbbd1423200e0ef23e186f04f9421df1b6b765f7 /src/corelib/serialization/qcborstream.cpp
parent69ef6e821287d324459336dd1292d19d272386b8 (diff)
parenta96a64be2dc3110d140e43d2cf85454d9fc998b8 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13
Diffstat (limited to 'src/corelib/serialization/qcborstream.cpp')
-rw-r--r--src/corelib/serialization/qcborstream.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp
index 078c14a32d..c598eee213 100644
--- a/src/corelib/serialization/qcborstream.cpp
+++ b/src/corelib/serialization/qcborstream.cpp
@@ -1972,7 +1972,15 @@ inline void QCborStreamReader::preparse()
if (lastError() == QCborError::NoError) {
type_ = cbor_value_get_type(&d->currentElement);
- if (type_ != CborInvalidType) {
+ if (type_ == CborInvalidType) {
+ // We may have reached the end.
+ if (d->device && d->containerStack.isEmpty()) {
+ d->buffer.clear();
+ if (d->bufferStart)
+ d->device->skip(d->bufferStart);
+ d->bufferStart = 0;
+ }
+ } else {
d->lastError = {};
// Undo the type mapping that TinyCBOR does (we have an explicit type
// for negative integer and we don't have separate types for Boolean,