SheenBidi: PopulateBidiChain in some situations leaves SBBidiType portion of memory uninitialized.

I checked with valgrind that on every run it reports “==2247== Warning: unimplemented fcntl command: 1033 ==2247== Thread 32: ==2247== Conditional jump or move depends on uninitialised value(s) ==2247== at 0x14B4107: SBAlgorithmCreateParagraph” I tried to narrow down the part of memory which is uninitialized according to valgrind and it came out that if I will add in CreateParagraphContext function just after BidiChainInitialize additional code

for (int i = 0;i < length;++i) fixedTypes[i] = SBBidiTypeNil;

the valgrind is not reporting any problem.

I followed PopulateBidiChain code and it looks that in some cases it can omit initialization of some links in the chain. I do not understand sheenbidi well enough to say if this mean we have a data error in such case. Anyway application is not crashing because of it, the only visible problem so far is valgrind report.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (12 by maintainers)

Commits related to this issue

Most upvoted comments

I have added valgrind job in the linux workflow as part of commit 7bcdd13. It’s passing now as shown in Make - Valgrind job. Hopefully such issues will be easily caught by the CI in future.

Has malloc secretly been made to initialize the allocated memory in all major compilers?

No, this is just luck. https://stackoverflow.com/a/8029624

Can confirm it looks like that solves it!