JXL: Fix OSS Fuzz issue 377971416

This commit is contained in:
Mirco Miranda 2024-11-09 10:44:04 +00:00
parent 8265b3602b
commit b645c9c258

View File

@ -1172,7 +1172,7 @@ bool QJpegXLHandler::decodeBoxes()
JxlDecoderGetBoxType(m_decoder, type, JXL_FALSE);
if (memcmp(type, "xml ", 4) == 0) {
uint64_t size;
if (JxlDecoderGetBoxSizeRaw(m_decoder, &size) == JXL_DEC_SUCCESS) {
if (JxlDecoderGetBoxSizeRaw(m_decoder, &size) == JXL_DEC_SUCCESS && size < uint64_t(kMaxQVectorSize)) {
m_xmp = QByteArray(size, '\0');
JxlDecoderSetBoxBuffer(m_decoder, reinterpret_cast<uint8_t *>(m_xmp.data()), m_xmp.size());
}