这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@atlimit8
Copy link
Member

I found this possible underflow while reviewing #20020. It was originally while ((i >= 0) && (n[i] == 0)) i--; where i >= 0 was always true since i is a uint.

To see the difference try

var n = new uint[] { 0, 0, 8, 1, 0, 0 };
var i = 2U - 1;
while (i < uint.MaxValue && n[i] == 0) i--;

versus

var n = new uint[] { 0, 0, 8, 1, 0, 0 };
var i = 2U - 1;
while (n[i] == 0) i--;

@atlimit8 atlimit8 force-pushed the BlowfishKeyProvider-no-wrap-around branch from 8f491f6 to bbd6c45 Compare May 8, 2025 01:18
Copy link
Member

@Mailaender Mailaender left a comment

Choose a reason for hiding this comment

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

The underflow should lead to an IndexOutOfRangeException later on in BlowfishKeyProvider which has never been reported in the wild. I still think that this additional guard is useful.

@Mailaender Mailaender merged commit c56d2c1 into OpenRA:bleed Jul 27, 2025
2 checks passed
@Mailaender
Copy link
Member

Changelog

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.

4 participants