-
-
Notifications
You must be signed in to change notification settings - Fork 315
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
uncompressed: add sanity limit check on number of tile rows and cols #1207
uncompressed: add sanity limit check on number of tile rows and cols #1207
Conversation
We might be able to omit that limit for grid images (total image size) because with the planned ROI decoding, it would be perfectly fine to have a huge image above the security limit if each tile is below the limit. |
Image Grid has a maximum of 256 tile rows/columns, stored in uint16. |
Ah, indeed. Mixed up the image size and the tile limits. |
I suggest that we limit the total number of tiles instead of width/height separately, as was recently implemented in #1204 I.e. |
Sounds reasonable.
Is this the limit value you want to use? Essentially allowing number of tiles to equal number of pixels? |
I just used your Thus: do we need a tile limit? |
OK. So the plan is to limit number of uncompressed tile rows and tile columns to less than what can be represented in uint32_t (i.e. just avoiding the overflow in #1206), and not limiting grid. Then for really huge images, the user only has to increase the maximum image size limits, and we don't need to add API to change the tile size limits. Does that seem reasonable? |
Yes. And for huge images, the user does not even have to increase the limit if he is accessing the image only in small ROIs that are below the limit. (Through the ROI decoding API that I'm going to add.) |
307755d
to
bd5748f
Compare
Have rebased. Should now match the intent above. |
Looks good. Thank you. |
Resolves #1206
Includes unit test.
This does not make the limit configurable, but that could be added.
Should we have the same limit for the number of image grid rows and columns? That already has a short-form and long-form option, but no limits on the long form case:
libheif/libheif/context.cc
Lines 189 to 212 in 7a8c58e