-
Notifications
You must be signed in to change notification settings - Fork 461
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
Test 481 reports error in valgrind memcheck #612
Comments
The bug occurs after a code sequence like this: opj_mqc_byteout reads *bp, increments bp, writes to *bp Other sequences which work look like this: opj_mqc_byteout reads *bp, increments bp, writes to *bp So the opj_mqc_restart_init_enc is missing in the error case. |
This problem only occurs in BYPASS and RESTART encode modes, which are known to be broken anyways. I think we should disable these two modes until they are working correctly, and mention this in the release notes. Then the release can proceed more quickly - seems like many people are waiting for it. My 2cents. |
See also #674 |
I took a little time to investigate further. Allocation is done here : I don't have enough knowledge of the internals here. I understand p_code_block->data is supposed to store encoded stream, so I don't get why it is allocated based on a number of pixels, and there is no comment in the code in tcd.c. |
How do you know that the uninitialized read happens at the end of the code block buffer? |
By debugging |
Well, in order to resolve this, we need to first fix bypass and restart mode |
I tend to think they are the same. As said in #674 the out of bounds read happens only in RESTART and BYPASS mode, not with the other modes. Extending the allocated buffer, even a lot, does not change anything. |
Julien, thanks for pursuing this. Do you have time to check a few things?
Also, this is how I fixed the valgrind error in my fork: GrokImageCompression/grok@3d9ee7a Can you try these changes and see if the problem goes away? Thanks! |
is the important line. For bpno == 0, there is no termination. That is why you are seeing the encoder go into an endless loop. Simply remove bpno > 0 and it should fix the valgrind error. Of course, lossless encoding may still be lossy, but that is a bigger issue. |
Fixed per #949 |
Running the test manually with a debug version of opj_compress built from latest git code:
Result:
All other reported contexts seem to be caused by the same uninitialized tile data.
The text was updated successfully, but these errors were encountered: