Don't rely on uninitialized data
authorJoão Abecasis <joao.abecasis@nokia.com>
Mon, 2 May 2011 11:49:36 +0000 (13:49 +0200)
committerOlivier Goffart <olivier.goffart@nokia.com>
Tue, 10 May 2011 10:54:55 +0000 (12:54 +0200)
HB_GetCharAttributes used to require a zero-initialized array for
attributes, as it selectively sets relevant bits for each character. We
ease that requirement by always initializing the attributes buffer
explicitly with memset.

Task-number: QT-4911
Reviewed-by: Ritt Konstantin
(cherry picked from commit 4cb9db404224c55859713c282aa90409e375c372)

src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp

index c202e1f..3410782 100644 (file)
@@ -655,6 +655,7 @@ void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength,
                           const HB_ScriptItem *items, hb_uint32 numItems,
                           HB_CharAttributes *attributes)
 {
+    memset(attributes, 0, stringLength * sizeof(HB_CharAttributes));
     calcLineBreaks(string, stringLength, attributes);
 
     for (hb_uint32 i = 0; i < numItems; ++i) {