mirror of https://github.com/qt/qtgrpc.git
Fix restoring previous iterator in deserializeObject
We were previously just restoring the iterator in one branch. This made it really hard to debug unrelated issues that happened to leave through another branch. This changes what iterator we are checking for validity before leaving the function, but the iterator shouldn't have consumed more data than is available in the buffer, so it should be valid anyway. Pick-to: 6.8 6.7 Change-Id: Iaa818a54961feacb50a20a1f9770a05308cb2485 Reviewed-by: Tatiana Borisova <tatiana.borisova@qt.io> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
a07a905094
commit
cf3dfbf511
|
|
@ -330,8 +330,9 @@ bool QProtobufSerializerPrivate::deserializeObject(QProtobufMessage *message)
|
|||
setUnexpectedEndOfStreamError();
|
||||
return false;
|
||||
}
|
||||
auto store = it;
|
||||
QByteArrayView data = array.value();
|
||||
auto prevIt = it;
|
||||
auto restoreOnReturn = qScopeGuard([&](){ it = prevIt; });
|
||||
QByteArrayView data = *array;
|
||||
clearError();
|
||||
it = QProtobufSelfcheckIterator::fromView(data);
|
||||
while (it.isValid() && it != data.end()) {
|
||||
|
|
@ -340,7 +341,6 @@ bool QProtobufSerializerPrivate::deserializeObject(QProtobufMessage *message)
|
|||
}
|
||||
if (!it.isValid())
|
||||
setUnexpectedEndOfStreamError();
|
||||
it = store;
|
||||
return it.isValid();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue