Skip to content

heifload: limit per-image memory usage to 2GB by default #4514

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

lovell
Copy link
Member

@lovell lovell commented May 12, 2025

The upstream default is 4GB, which is too big for the fuzz test environment and IMHO is too big for a sensible default. Halving the default limit to 2GB means all the current "Out-of-memory" fuzz test failures will go away, and seems to be sufficient to process all the HEIF images I've tested with. It is however an(other) arbitrary value and I'd be happy to modify it based on further feedback.

The existing unlimited flag can be used to remove this.

Before:

$ vips heifload clusterfuzz-testcase-minimized-rawsave_buffer_fuzzer-6038980984635392
clusterfuzz-testcase-minimized-rawsave_buffer_fuzzer-6038980984635392: bad seek to 1024
...
heif: Invalid input: Unexpected end of file (2.100)

After:

$ vips heifload clusterfuzz-testcase-minimized-rawsave_buffer_fuzzer-6038980984635392
clusterfuzz-testcase-minimized-rawsave_buffer_fuzzer-6038980984635392: bad seek to 1024
...
heif: Memory allocation error: Security limit exceeded: Memory usage of 3774939392 bytes for the 'saio' table exceeds the security limit of 2147483648 bytes of total memory usage (6.1000)

After with --unlimited flag:

$ vips heifload clusterfuzz-testcase-minimized-rawsave_buffer_fuzzer-6038980984635392 --unlimited
clusterfuzz-testcase-minimized-rawsave_buffer_fuzzer-6038980984635392: bad seek to 1024
...
heif: Invalid input: Unexpected end of file (2.100)

The existing unlimited flag can be used to remove this
Copy link
Member

@jcupitt jcupitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2GB sounds reasonable to me.

@lovell lovell merged commit d87f9ed into libvips:master May 13, 2025
6 checks passed
@lovell lovell deleted the heifload-limit-max-memory branch May 13, 2025 08:07
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 this pull request may close these issues.

2 participants