Don't rely on uninitialized data

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)
This commit is contained in:
João Abecasis 2011-05-02 13:49:36 +02:00 committed by Olivier Goffart
parent e6e6e4c169
commit 1787e557e8

View File

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