-
Notifications
You must be signed in to change notification settings - Fork 612
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
ImageBufImpl doesn't check validity of subimage before checking mips #1670
Comments
Yes, both the subimage and miplevel indexing starts at 0. I agree, it would be better to fail gracefully than to assert. I'll see if your suggested patch covers all the cases. |
lgritz
added a commit
to lgritz/OpenImageIO
that referenced
this issue
Apr 18, 2017
Proposed fix (slightly more comprehensive) in #1672. |
Looks good to me :) Thanks! |
lgritz
added a commit
to lgritz/OpenImageIO
that referenced
this issue
Apr 18, 2017
lgritz
added a commit
to lgritz/OpenImageIO
that referenced
this issue
Apr 18, 2017
lgritz
added a commit
to lgritz/OpenImageIO
that referenced
this issue
Apr 18, 2017
Merged into master and RB-1.7. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I pass a subimage in, greater than or equal to the number of subimages that exist, getting the number of mips will assert.
I have an underlying assumption that if I read in vanilla jpeg file, then the number of subimages is 1, and the valid index is zero. Please let me know if I've got that wrong.
The assert will occur in the next line because ultimately ImageCacheFile::levelInfo will assert that the subimage value is valid.
Rather than asserting, wouldn't it make sense to range check it before calling get_image_info, and not call the function if out of range? In a release build it'll crash since it results in an out-of-bounds read in levelInfo.
I ran into this because Usd does the following. As you can see it starts off with an out of range query, since the range index starts at 1 instead of 0. (At least according to my base assumption 1 is out of range.)
The call stack is pretty deep, so I'm not reproducing it here. I'm guessing I'm doing something off the main track from what Pixar is doing, causing me to hit this assertion where they aren't.
Update:
This gets me past the crash, and functioning properly, at least if my assumption is correct.
The text was updated successfully, but these errors were encountered: