-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PopulateBidiChain in some situations leaves SBBidiType portion of memory uninitialized. #19
Comments
This can be safely ignored since uninitalized links are never read anyway. Basically it mimicks a linked list but with a pre allocated array. This helps overcome the The chain is iterated from the |
@mta452 wrote:
That is still annoying, even if it presumably does not have bad consequences in this case. One would expect to have clean report from valgrind, otherwise it becomes nearly impossible to know what's fine and what is done when checking software that integrates many 3rd party libs. To be pedantic, a condition that depends on uninitialized memory is undefined behavior, and UB is always a bug (which may or may not have consequences in some cases, but that's unpredictable on all toolchains/platforms). |
This is incorrect, because the array is actually of length for (SBUInteger i = 0; i < length + 2; ++i) {
fixedTypes[i] = SBBidiTypeNil;
}
I very much agree. This affects us too (us being the VVVVVV developers) as we are looking to integrate SheenBidi (see TerryCavanagh/VVVVVV#1093) but this error keeps coming up in Valgrind. Can we send a pull request to fix this? |
This fixes an error of reading uninitialized memory, as reported by Valgrind. Fixes Tehreer#19.
This fixes an error of reading uninitialized memory, as reported by Valgrind. Fixes Tehreer#19.
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.
The text was updated successfully, but these errors were encountered: