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

Require allocation size be <= PTRDIFF_MAX #2364

Conversation

wantehchang
Copy link
Collaborator

This makese it safe to cast rowBytes to ptrdiff_t.

Part of the fix to #2354.

This makese it safe to cast rowBytes to ptrdiff_t.

Part of the fix to AOMediaCodec#2354.
@wantehchang wantehchang requested a review from jzern August 1, 2024 19:02
}
#endif
if (image->height > SIZE_MAX / fullRowBytes) {
if (image->height > PTRDIFF_MAX / fullRowBytes) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ideally we should add static_assert(PTRDIFF_MAX <= SIZE_MAX); if this is not guaranteed by the C standard.

@wantehchang wantehchang merged commit 9ea9a94 into AOMediaCodec:main Aug 2, 2024
14 checks passed
@wantehchang wantehchang deleted the check-PTRDIFF_MAX-instead-of-SIZE_MAX branch August 2, 2024 22:43
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