Skip to content

Fix potential integer overflow issues#4429

Merged
lum1n0us merged 1 commit intobytecodealliance:mainfrom
lum1n0us:fix/integer_overflowing1
Jul 1, 2025
Merged

Fix potential integer overflow issues#4429
lum1n0us merged 1 commit intobytecodealliance:mainfrom
lum1n0us:fix/integer_overflowing1

Conversation

@lum1n0us
Copy link
Copy Markdown
Contributor

It is reported as "Multiplication result converted to larger type". And "Multiplication result may overflow 'Type A' before it is converted to 'Type B'." Type A is a larger type than Type B.

Since the conversion applies after the multiplication, arithmetic overflow may still occur.

The rule flags every multiplication of two non-constant integer expressions
that is (explicitly or implicitly) converted to a larger integer type. The
conversion is an indication that the expression would produce a result that
would be too large to fit in the smaller integer type.

It is reported as "Multiplication result converted to larger type".
And "Multiplication result may overflow 'Type A' before it is
converted to 'Type B'." Type A is a larger type than Type B.

Since the conversion applies after the multiplication, arithmetic
overflow may still occur.

> The rule flags every multiplication of two non-constant integer expressions
> that is (explicitly or implicitly) converted to a larger integer type. The
> conversion is an indication that the expression would produce a result that
> would be too large to fit in the smaller integer type.
@yamt
Copy link
Copy Markdown
Contributor

yamt commented Jun 30, 2025

It is reported as "Multiplication result converted to larger type". And "Multiplication result may overflow 'Type A' before it is converted to 'Type B'." Type A is a larger type than Type B.

reported by what?

Comment thread core/iwasm/compilation/aot_emit_aot_file.c
Comment thread core/iwasm/compilation/aot_emit_function.c
@lum1n0us
Copy link
Copy Markdown
Contributor Author

lum1n0us commented Jul 1, 2025

@lum1n0us lum1n0us merged commit c7148a6 into bytecodealliance:main Jul 1, 2025
556 of 562 checks passed
@lum1n0us lum1n0us deleted the fix/integer_overflowing1 branch July 1, 2025 05:39
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.

3 participants