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

potential issue in TxQuantize.cpp #100

Closed
bugfood opened this issue Aug 6, 2018 · 2 comments
Closed

potential issue in TxQuantize.cpp #100

bugfood opened this issue Aug 6, 2018 · 2 comments

Comments

@bugfood
Copy link
Contributor

bugfood commented Aug 6, 2018

I noticed that in TxQuantize.cpp in TxQuantize::quantize, there is a section of code with the relevant parts:

for (i = 0; i < numcore - 1; i++) {
    ...
    if (i == numcore-1)
        ...
    ...
    thrd[i] = SDL_CreateThread(QuantizeThreadFunc, "quantizer", &params[i]);
    ...
}
for (i = 0; i < numcore; i++) {
    SDL_WaitThread(thrd[i], NULL);
}    

Should the first for loop have i < numcore?

I think the following are currently true:

  1. The conditional in the body of the loop won't ever succeed.
  2. SDL_WaitThread will get an uninitialized value.

I don't know how to exercise this function, but it didn't quite look right to me.

Thanks,
Corey

@richard42
Copy link
Member

Definitely a bug. It looks to me like the "numcore - 1" in the for loop statement should just be "numcore"

@bugfood
Copy link
Contributor Author

bugfood commented Aug 28, 2018

Ok, that's what I thought. Changing it is trivial, though I don't know how to test it. If you want this PR...

#101

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants