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

Fix unary minus operator applied to unsigned int #2069

Merged
merged 1 commit into from
Dec 11, 2019
Merged

Fix unary minus operator applied to unsigned int #2069

merged 1 commit into from
Dec 11, 2019

Conversation

Daeren
Copy link
Contributor

@Daeren Daeren commented Dec 11, 2019

Applying unary minus operator to unsigned int causes the following error on MSVS: error C4146
This patch fixes the error.

Applying unary minus operator to unsigned int causes the following error on MSVS: error C4146
This patch fixes the error.
@behdad behdad merged commit 4ef597e into harfbuzz:master Dec 11, 2019
@ebraminio
Copy link
Collaborator

ebraminio commented Feb 11, 2020

This change caused the following ubsan failure,

clusterfuzz-testcase-minimized-hb_shape_fuzzer-5633785895911424
src/hb-ot-color-sbix-table.hh:304:28: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself

which is reported as https://crbug.com/1050424

ebraminio added a commit that referenced this pull request Feb 11, 2020
Newer versions of MSVC with /we4146 don't like putting negative sign behind a
unsigned number as #2069
That however have made https://crbug.com/1050424 this complain:
  src/hb-ot-color-sbix-table.hh:304:28: runtime error: negation of -2147483648 cannot be represented in type 'int';
                                        cast to an unsigned type to negate this value to itself
which apparently can be fixed using this change.

Let's see if this won't make another ubsan complain!
@ebraminio
Copy link
Collaborator

Have applied ff984ed wondering if that won't make another ubsan complain, let's see. Someone should add the flag, /we4146 or /SDL, to our cmake build script so we now we don't break it in future.

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