Merge "Avoid undefined color values in corrupt xpm image"

This commit is contained in:
Eirik Aavitsland 2021-03-10 15:18:03 +01:00 committed by Qt CI Bot
commit f0862c08f1

View File

@ -934,7 +934,7 @@ static bool read_xpm_body(
colorMap.insert(xpmHash(QLatin1String(index.constData())), 0); colorMap.insert(xpmHash(QLatin1String(index.constData())), 0);
} }
} else { } else {
QRgb c_rgb; QRgb c_rgb = 0;
if (((buf.length()-1) % 3) && (buf[0] == '#')) { if (((buf.length()-1) % 3) && (buf[0] == '#')) {
buf.truncate(((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick buf.truncate(((buf.length()-1) / 4 * 3) + 1); // remove alpha channel left by imagemagick
} }