ASF: Bounds check the size of each header object

UBSan spotted an integer overflow on the line `dataPos += size`, so add
a bounds check to the size that we read.
This commit is contained in:
bobsayshilol
2021-05-02 12:14:27 +02:00
committed by Urs Fleisch
parent 51ae5748cb
commit d74689cb93
+1 -1
View File
@@ -384,7 +384,7 @@ void ASF::File::FilePrivate::HeaderExtensionObject::parse(ASF::File *file, unsig
}
bool ok;
long long size = readQWORD(file, &ok);
if(!ok) {
if(!ok || size < 0 || size > dataSize - dataPos) {
file->setValid(false);
break;
}