From e5c1572e7eafbce26ca5835c7fe1682bfb69d92b Mon Sep 17 00:00:00 2001 From: Axel Rasmussen Date: Sun, 19 Oct 2014 11:09:37 -0600 Subject: 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 --- src/gui/text/qfontengine_ft.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gui/text/qfontengine_ft.cpp') diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 6dd8585483..b0cfa49b36 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -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; -- cgit v1.2.3