-
Notifications
You must be signed in to change notification settings - Fork 183
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
Handle out-of-memory errors, such as avifAlloc() failures #820
Comments
Add the AVIF_RESULT_OUT_OF_MEMORY error code. Add the avifArrayPop() function to remove the last element in the array. Bug: AOMediaCodec#820.
Add the AVIF_RESULT_OUT_OF_MEMORY error code. Add the avifArrayPop() function to remove the last element in the array. Bug: AOMediaCodec#820.
Add the AVIF_RESULT_OUT_OF_MEMORY error code. Add the avifArrayPop() function to remove the last element in the array. Bug: AOMediaCodec#820.
Add the AVIF_RESULT_OUT_OF_MEMORY error code. Add the avifArrayPop() function to remove the last element in the array. Bug: AOMediaCodec#820.
Add the AVIF_RESULT_OUT_OF_MEMORY error code. Add the avifArrayPop() function to remove the last element in the array. Bug: #820.
Fix a bug introduced in commit f732a4d. In avifEncoderDataCreateItem(), increment data->lastItemID before setting item->id equal to data->lastItemID. This is what the original code did. Bug: AOMediaCodec#820
Allow avifDecoderDataCreateTile() to fail on avifImageCreateEmpty() or avifCodecDecodeInputCreate() failures. Note that we don't check for avifArrayPushPtr() failure yet. That will be done later. Change all avifDecoderDataCreateTile() callers to handle its failures. Bug: AOMediaCodec#820
Allow avifDecoderDataCreateTile() to fail on avifImageCreateEmpty() or avifCodecDecodeInputCreate() failures. Note that we don't check for avifArrayPushPtr() failure yet. That will be done later. Change all avifDecoderDataCreateTile() callers to handle its failures. Bug: #820
This is part of a series of changes to replace abort() by return null upon memory allocation failure in avifAlloc(). Bug: AOMediaCodec#820
This is part of a series of changes to replace abort() by return null upon memory allocation failure in avifAlloc(). Bug: #820
Also avifImageSetProfileICC(), avifImageSetMetadataExif(), avifImageSetMetadataXMP() and avifCodecEncodeOutputAddSample(). To catch out-of-memory issues. Bug: AOMediaCodec#820
Also avifImageSetProfileICC(), avifImageSetMetadataExif(), avifImageSetMetadataXMP() and avifCodecEncodeOutputAddSample(). To catch out-of-memory issues. Bug: #820
On memory allocation failure, the current behavior is to abort the process. We are working to change avifAlloc() to return NULL. See AOMediaCodec#820.
On memory allocation failure, the current behavior is to abort the process. We are working to change avifAlloc() to return NULL. See #820.
All |
I confirm all avifAlloc are checked. |
Yannis: Thank you very much for all your work on this issue! This is an enormous amount of work and requires patience and perseverance. I changed the assignee to you and removed myself. (The initial work I did is insignificant compared with what you have done.) Does this mean we can remove the abort() call in avifAlloc() now? |
Thanks.
Yes. I was wondering if adding a test or fuzz target to exercise |
Once the changes above are merged, the There are a few allocations in I can imagine other dependencies such as libaom bringing the same risk. Should this bug be closed before all dependencies are safe? |
I suggest closing this issue as completed and open a new issue about libyuv. Unlike libyuv, libaom aims to handle memory allocation failures (see https://crbug.com/aomedia/3276), so it doesn't seem necessary to file a new issue about libaom. |
Sorry, I forgot the code in third_party/libyuv. In my previous comment, I was referring to the upstream libyuv. We can probably also open a new issue about the code in third_party/libyuv. Or we can leave this issue open until that code is fixed. |
I agree.
Great. What about other dependencies, especially dav1d? I think libsharpyuv is fine too, right @vrabaud? |
Indeed, fr libsharpyuv, allocs are only done in one spot and they are checked: https://chromium.googlesource.com/webm/libwebp/+/refs/heads/main/sharpyuv/sharpyuv.c#331 |
Yannis: I randomly inspected a few calls to |
Now that it is done, all core library places should be checked now. |
This issue tracks the work on handling out-of-memory errors, starting with avifAlloc() failures.
I will do this work in installments because this requires a lot of changes.
The text was updated successfully, but these errors were encountered: