-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Core dump in HuffmanEncoder::GenerateCodeLengths in case of only one leaf in tree. #242
Conversation
…y one leaf in tree.
Thanks @kvirund. Do you have small test case for the crash? I'd like to add it to our test suite. |
Unfortunately I cannot share that data, but I will try to build another test case. |
Actually, I can share values of arguments passed into
|
Essentially the code to reproduce the error is:
At line Update: Actually now I cannot reproduce it from scratch even on Windows because at line |
Does that mean something else changed (like you started working from Master) and the issue is no longer present? Or does that mean the issue still exists, but the test case does not capture it? Or maybe something else? I guess the second question is, do we still need to consider the pull request? Sorry to have to ask. This looks fishy: |
No, issue still exists. Just when I tried to reproduce it I built latest version of CryptoPP and in this version variables ( I got value Code that I mentioned is the reproducible case. Just I don't know how to compile project so that tree is initialized by |
Ah, OK, thank you very much. I did not realize a union was in play. Related, in C++, its undefined behavior to read from the inactive union member. In practice nearly every (every?) C++ compiler does the right thing because its legal to do in C. I've seen that before under MSVC++. I encountered it when trying to avoid an unitialized warning for
|
Actually the problem is not in the initializing. Trash in high part of If I understand right, algorithm should build After that, algorithm recursively counts depth of each node at |
I added the test case at Commit 1e7c837442231a55. Thank you very much. The test case does not trigger on OS X or Linux, so I don't know if the reworked There could be two different problems here. If that's the case, then I want to work the initialization problem first. Once I know the |
Do you need something else from me? |
Well, I'm not sure. I tested Commit 1e7c837442231a55 on Windows 7 with both Visual Studio 2010 and 2012 under both X86 and X64. I can't seem to reproduce the issue. What version of the library are you experiencing the issue? 5.6.3 ZIP? Master? Something else? What platform and compiler are you experiencing the issue? |
It was Microsoft Visual Studio 2010, Windows 7. But I did not use CMake script that comes with library. I just compiled all source files with my own flags. Actually, I think core dump will not be reproduced anymore. But don't you agree with my reasonings? I mean my notice that the loop at |
In that case, I would prefer not take action. I want to avoid inadvertently breaking something with an unintended consequence. After AES and SHA, the compressors and decompressors are some of the hairiest code in the library. In Issue 83: zdeflate error I knocked something loose while chasing an uninitialized bug that surfaced under Valgrind. It took some time for the break to surface and subsequent fix, and I don't want to repeat it. I'm not married to the "no action" position. If I can get hold of a test case that reproduces the issue, then I'm happy to move against it. |
No description provided.