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

Add a maxImageSize decoder setting to avifDecoder. #263

Closed
wantehchang opened this issue Aug 10, 2020 · 1 comment · May be fixed by #527
Closed

Add a maxImageSize decoder setting to avifDecoder. #263

wantehchang opened this issue Aug 10, 2020 · 1 comment · May be fixed by #527

Comments

@wantehchang
Copy link
Collaborator

In the following two commits I added a hardcoded AVIF_MAX_IMAGE_SIZE:

0a8e724
2fb6361

Ideally the maximum image size should be a configurable decoder setting. We can add a maxImageSize decoder setting to the avifDecoder struct.

We will need to validate the maxImageSize value. Also, to support large maxImageSize values, some arithmetic operations involving the image width, height, or row bytes that currently use the int or unsigned int type will need to use the size_t type instead. We also need to handle a 32-bit size_t correctly.

wantehchang added a commit to wantehchang/libavif that referenced this issue Aug 5, 2021
Adapted from Joe Drago's pull request
AOMediaCodec#527, with the limitation
that decoder->imageSizeLimit must be less than or equal to the default
value and must not be set to 0 (reserved for future use). This way we
don't need to audit our code for integer overflows due to a large image
width or height.

Set decoder->imageSizeLimit to 11 * 1024 * 10 * 1024 in
avif_decode_fuzzer.cc to keep its memory consumption under 2560 MB.

AOMediaCodec#263
wantehchang added a commit that referenced this issue Aug 6, 2021
Adapted from Joe Drago's pull request
#527, with the limitation
that decoder->imageSizeLimit must be less than or equal to the default
value and must not be set to 0 (reserved for future use). This way we
don't need to audit our code for integer overflows due to a large image
width or height.

Set decoder->imageSizeLimit to 11 * 1024 * 10 * 1024 in
avif_decode_fuzzer.cc to keep its memory consumption under 2560 MB.

#263
wantehchang added a commit to wantehchang/libavif that referenced this issue Aug 6, 2021
Add custom diagnostic messages if item size, track size, or grid
dimensions exceed imageSizeLimit.

Related to AOMediaCodec#263.
wantehchang added a commit that referenced this issue Aug 6, 2021
Add custom diagnostic messages if item size, track size, or grid
dimensions exceed imageSizeLimit.

Related to #263.
@wantehchang
Copy link
Collaborator Author

Fixed by commit 980d585 and commit bd1492e.

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

Successfully merging a pull request may close this issue.

1 participant