Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initialize memory of bidi chain
Browse files Browse the repository at this point in the history
This fixes an error of reading uninitialized memory, as reported by
Valgrind.

Fixes #19.
InfoTeddy committed Jan 10, 2024
1 parent e667eb3 commit c1ea590
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Source/SBParagraph.c
Original file line number Diff line number Diff line change
@@ -60,8 +60,12 @@ static ParagraphContextRef CreateParagraphContext(const SBBidiType *types, SBLev
ParagraphContextRef context = (ParagraphContextRef)(memory + offsetContext);
BidiLink *fixedLinks = (BidiLink *)(memory + offsetLinks);
SBBidiType *fixedTypes = (SBBidiType *)(memory + offsetTypes);
SBUInteger i;

BidiChainInitialize(&context->bidiChain, fixedTypes, levels, fixedLinks);
for (i = 0; i < length + 2; ++i) {
fixedTypes[i] = SBBidiTypeNil;
}
StatusStackInitialize(&context->statusStack);
RunQueueInitialize(&context->runQueue);
IsolatingRunInitialize(&context->isolatingRun);

0 comments on commit c1ea590

Please sign in to comment.