Skip to content

Commit

Permalink
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 Tehreer#19.
  • Loading branch information
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
Expand Up @@ -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);
Expand Down

0 comments on commit c1ea590

Please sign in to comment.