dicom: enforce reasonable resolution limits to guard against corrupt file#5167
Conversation
…files Signed-off-by: Larry Gritz <lg@larrygritz.com>
|
Any comments on this one? |
jessey-git
left a comment
There was a problem hiding this comment.
Seems alright given my comment below.
|
|
||
| m_spec = ImageSpec(m_img->getWidth(), m_img->getHeight(), nchannels, | ||
| format); | ||
| if (!check_open(m_spec, { 0, 1 << 20, 0, 1 << 20, 0, 1 << 16, 0, 1 << 16 })) |
There was a problem hiding this comment.
That's a very big image... 62bits required if utilizing the entire space there :) I wasn't able to find the format limits going through their docs but this seems reasonable until we're told otherwise.
There was a problem hiding this comment.
These are the limits on individual dimensions. There's a separate limit on the total (w x h x d x chans x channelsize). It won't really allocate for a 1M x 1M image unless the app raises that limit via an attribute, but why not let it do 1M x 16? DICOM is for scientific and medical data, so it may have weirder shapes than the kinds of images that we generally use.
There was a problem hiding this comment.
Yeah, still protected by "imagesize_MB" setting, it was just a general "Wow that would be a big image, I hope the doc never needs something like that for me."
No description provided.