Avoid undefined color values in corrupt xpm image
Issue reported by Codechecker. Pick-to: 6.1 6.0 5.15 5.12 Change-Id: I1a5aa2203fb31e0ce3b630a11e450925aee81fb0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
ae88dea1be
commit
f651e6a26c
@ -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
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user