Skip to content

Comments

Prevent integer overflows in src/gainmap.c#3051

Merged
wantehchang merged 1 commit intoAOMediaCodec:mainfrom
wantehchang:prevent-integer-overflow-in-gainmap-c
Feb 24, 2026
Merged

Prevent integer overflows in src/gainmap.c#3051
wantehchang merged 1 commit intoAOMediaCodec:mainfrom
wantehchang:prevent-integer-overflow-in-gainmap-c

Conversation

@wantehchang
Copy link
Collaborator

Prevent integer overflows in multiplications involving width, height, and rowBytes in src/gainmap.c by performing the multiplications in the size_t type. The size_t type is large enough because pixel buffers for the width, height, and rowBytes have been allocated successfully.

"Dexter.k" 164054284+rootvector2@users.noreply.github.com reported an integer overflow in the allocation of the gainMapF buffers in avifRGBImageComputeGainMap() and suggested a fix in #3049.

Prevent integer overflows in multiplications involving width, height,
and rowBytes in src/gainmap.c by performing the multiplications in the
size_t type. The size_t type is large enough because pixel buffers for
the width, height, and rowBytes have been allocated successfully.

"Dexter.k" <164054284+rootvector2@users.noreply.github.com> reported an
integer overflow in the allocation of the gainMapF buffers in
avifRGBImageComputeGainMap() and suggested a fix in
AOMediaCodec#3049.
@wantehchang
Copy link
Collaborator Author

@rootvector2 Dexter.k: FYI. I wrote this pull request by starting from your pull request #3049. After I discovered that much more changes should be made, I decided to create my own pull request rather than suggest changes to your pull request, and treat your pull request as a bug report.

Copy link
Contributor

@maryla-uc maryla-uc left a comment

Choose a reason for hiding this comment

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

Thanks a lot for the fix!

@wantehchang wantehchang merged commit 2fdc999 into AOMediaCodec:main Feb 24, 2026
25 checks passed
@wantehchang wantehchang deleted the prevent-integer-overflow-in-gainmap-c branch February 24, 2026 17:22
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