mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-06-03 17:08:08 -04:00
Fix uninitialized memory read
Summary: Make sure whole of pixel_size in pixel has data either because it was read or because we set it to 0 oss-fuzz/14565 Reviewers: dfaure, apol, vkrause Reviewed By: vkrause Subscribers: kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D23739
This commit is contained in:
parent
40353da5db
commit
4bf2894bde
@ -252,7 +252,10 @@ static bool LoadTGA(QDataStream &s, const TgaHeader &tga, QImage &img)
|
||||
// RLE pixels.
|
||||
assert(pixel_size <= 8);
|
||||
char pixel[8];
|
||||
s.readRawData(pixel, pixel_size);
|
||||
const int dataRead = s.readRawData(pixel, pixel_size);
|
||||
if (dataRead < (int)pixel_size) {
|
||||
memset(&pixel[dataRead], 0, pixel_size - dataRead);
|
||||
}
|
||||
do {
|
||||
memcpy(dst, pixel, pixel_size);
|
||||
dst += pixel_size;
|
||||
|
Loading…
x
Reference in New Issue
Block a user