Skip to content

Cast type before the left shift #353

Merged
merged 1 commit into from
Aug 28, 2022

Conversation

chihweitung
Copy link
Contributor

Building ipmitool with UBSAN and I got:

...
xxx/ipmitool/include/ipmitool/helper.h:191:14: runtime error: left shift of 160
by 24 places cannot be represented in type 'int'
    #0 0x55bddaa56f11 in ipmi32toh
       xxx/ipmitool/include/ipmitool/helper.h:191:14

Tested: with this, I tested ipmitool again and the issue disappeared.

Resolved: #352
Signed-off-by: Tom Tung shes050117@gmail.com

Building ipmitool with UBSAN and I got:
```
...
xxx/ipmitool/include/ipmitool/helper.h:191:14: runtime error: left shift of 160
by 24 places cannot be represented in type 'int'
    #0 0x55bddaa56f11 in ipmi32toh
       xxx/ipmitool/include/ipmitool/helper.h:191:14
```

Tested: with this, I tested ipmitool again and the issue disappeared.

Resolved: ipmitool#352
Signed-off-by: Tom Tung <shes050117@gmail.com>
@chihweitung
Copy link
Contributor Author

Hi @AlexanderAmelkin,

Could you help to review this PR? Thanks!

Copy link
Contributor

@AlexanderAmelkin AlexanderAmelkin left a comment

Choose a reason for hiding this comment

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

Good catch, thank you!

@AlexanderAmelkin AlexanderAmelkin merged commit 46fd8d9 into ipmitool:master Aug 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ubsan - left shift of 160 by 24 places cannot be represented in type 'int'
2 participants