mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-13 18:21:01 +00:00
Avoid underflow when calculating padding bytes
This commit is contained in:
@@ -933,11 +933,12 @@ QString BufferFormatter::DeclareStruct(QList<QString> &declaredStructs, const QS
|
||||
lastMemberStart += lastChild->byteOffset;
|
||||
}
|
||||
|
||||
const uint32_t size = GetVarSize(*lastChild);
|
||||
uint32_t padBytes = requiredByteStride - (lastMemberStart + size);
|
||||
const uint32_t structEnd = lastMemberStart + GetVarSize(*lastChild);
|
||||
|
||||
if(padBytes > 0)
|
||||
ret += lit(" ") + DeclarePaddingBytes(padBytes);
|
||||
if(requiredByteStride > structEnd)
|
||||
ret += lit(" ") + DeclarePaddingBytes(requiredByteStride - structEnd);
|
||||
else
|
||||
qCritical() << "Unexpected stride overlow at struct" << name;
|
||||
}
|
||||
|
||||
ret += lit("}\n");
|
||||
|
||||
Reference in New Issue
Block a user