Skip to content
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

MQ Encode :uninitialized memory access when first pass does not output any bytes #709

Closed
boxerab opened this issue Jan 29, 2016 · 2 comments

Comments

@boxerab
Copy link
Contributor

boxerab commented Jan 29, 2016

On the first pass of a code block, if there were no bytes output by the mq coder,
then the OpenJPEG mq coder will store a rate of -1 for this first pass.

After a correction factor is added, this is stored as a positive rate of 2. But still, this looks
like a bug to me: passes with zero rates are given different rates, depending on when they
occur in the code stream.

Also, these lines could cause an access to uninitialized memory:

    if((pass->rate>1) && (cblk->data[pass->rate - 1] == 0xFF)){
        pass->rate--;
    }

Because the rate is 2, but in fact no data has been output.

Looks like this is currently being reported by valgrind

@boxerab
Copy link
Contributor Author

boxerab commented Dec 29, 2016

Happy Holidays

@boxerab boxerab reopened this Dec 29, 2016
@rouault
Copy link
Collaborator

rouault commented Jul 5, 2017

This part of the code has been recently significantly reworked. I believe the above is fixed with that, but difficult to say given there's no reproducer given in the ticket. So closing. Re-open if you believe the issue is still there

@rouault rouault closed this as completed Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants