bool SkDescriptor::operator==(const SkDescriptor& other) const { // the first value we should look at is the checksum, so this loop // should terminate early if they descriptors are different. // NOTE: if we wrote a sentinel value at the end of each, we could // remove the aa < stop test in the loop... const uint32_t* aa = (const uint32_t*)this; const uint32_t* bb = (const uint32_t*)&other; const uint32_t* stop = (const uint32_t*)((constchar*)aa + fLength); do { if (*aa++ != *bb++) returnfalse;
} while (aa < stop); returntrue;
}
// Basic bounds check on header length to make sure that bodyLength calculation does not // underflow. if (descriptorHeader.getLength() < sizeof(SkDescriptor)) { return {}; }
uint32_t bodyLength = descriptorHeader.getLength() - sizeof(SkDescriptor);
// Make sure the fLength makes sense with respect to the incoming data. if (bodyLength > buffer.available()) { return {};
}
// If the fuzzer produces data but the checksum does not match, let it continue. This will boost // fuzzing speed. We leave the actual checksum computation in for fuzzing builds to make sure // the ComputeChecksum function is covered. #ifdefined(SK_BUILD_FOR_FUZZER)
SkDescriptor::ComputeChecksum(ad.getDesc()); #else if (SkDescriptor::ComputeChecksum(ad.getDesc()) != ad.getDesc()->fChecksum) { return {}; } #endif if (!ad.getDesc()->isValid()) { return {}; }
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.