Fix uninitialized value warning in QFontEngineFT.
When running an application which called e.g. QPainter::drawText under Valgrind, it would produce "Conditional jump or move depends on uninitialized value(s)" warnings, since we were allocating a buffer for a FreeType bitmap without initializing its contents. FreeType, apparently, does not set the value of all bytes in a bitmap buffer when it is used as a FT_Bitmap, so we were left with some uninitialized memory which was still being used. This commit fixes these warnings, and prevents any potential undefined behavior. [ChangeLog][QtGui][General] fixed use of uninitialized memory in the FreeType font engine Change-Id: Ia7b3595c78310ce41f76cb4546fc36016c0000a8 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
This commit is contained in:
parent
c30ccb0ecd
commit
e5c1572e7e
@ -1062,6 +1062,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph,
|
||||
(format == Format_A8 ? (info.width + 3) & ~3 : info.width * 4));
|
||||
glyph_buffer_size = pitch * info.height;
|
||||
glyph_buffer = new uchar[glyph_buffer_size];
|
||||
memset(glyph_buffer, 0, glyph_buffer_size);
|
||||
|
||||
if (slot->format == FT_GLYPH_FORMAT_OUTLINE) {
|
||||
FT_Bitmap bitmap;
|
||||
|
Loading…
Reference in New Issue
Block a user