-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix suspicious code fragments #112384
Fix suspicious code fragments #112384
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -66,7 +66,7 @@ public static void SetAsIConvertible(this ref ComVariant variant, IConvertible v | |||
case TypeCode.Int32: variant = ComVariant.Create(value.ToInt32(ci)); break; | ||||
case TypeCode.UInt32: variant = ComVariant.Create(value.ToUInt32(ci)); break; | ||||
case TypeCode.Int64: variant = ComVariant.Create(value.ToInt64(ci)); break; | ||||
case TypeCode.UInt64: variant = ComVariant.Create(value.ToInt64(ci)); break; | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may be a real bug There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a long-standing bug from at least .NET 6, likely .NET Framework (as it's in the DLR version this code was initially ported from as well): Line 307 in f1dd571
I think we can fix this going forward, but as this does change the variant type I'd be concerned of breaking consumers if we were to backport this fix. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I do not think this is something that we want to backport. |
||||
case TypeCode.UInt64: variant = ComVariant.Create(value.ToUInt64(ci)); break; | ||||
case TypeCode.Single: variant = ComVariant.Create(value.ToSingle(ci)); break; | ||||
case TypeCode.Double: variant = ComVariant.Create(value.ToDouble(ci)); break; | ||||
case TypeCode.Decimal: variant = ComVariant.Create(value.ToDecimal(ci)); break; | ||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -577,9 +577,6 @@ protected override void OutputMemberScopeModifier(MemberAttributes attributes) | |
case MemberAttributes.Override: | ||
Output.Write("Overrides "); | ||
break; | ||
case MemberAttributes.Private: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unreachable code. Legacy components - keeping the existing behavior. |
||
Output.Write("Private "); | ||
break; | ||
default: | ||
switch (attributes & MemberAttributes.AccessMask) | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3023,22 +3023,19 @@ private void ImplReadData(BinXmlToken tokenType) | |
|
||
private void ImplReadElement() | ||
{ | ||
if (3 != _docState || 9 != _docState) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Always true. |
||
switch (_docState) | ||
{ | ||
switch (_docState) | ||
{ | ||
case 0: | ||
_docState = 9; | ||
break; | ||
case 1: | ||
case 2: | ||
_docState = 3; | ||
break; | ||
case -1: | ||
throw CreateUnexpectedTokenException(_token); | ||
default: | ||
break; | ||
} | ||
case 0: | ||
_docState = 9; | ||
break; | ||
case 1: | ||
case 2: | ||
_docState = 3; | ||
break; | ||
case -1: | ||
throw CreateUnexpectedTokenException(_token); | ||
default: | ||
break; | ||
} | ||
_elemDepth++; | ||
if (_elemDepth == _elementStack.Length) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -734,7 +734,7 @@ private static bool MatchesTheFilter(MethodBuilderImpl method, BindingFlags meth | |
|
||
if (argType.IsArray != paramType.IsArray || | ||
argType.IsByRef != paramType.IsByRef || | ||
argType.IsPointer != argType.IsPointer) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a real corner case bug, but I do not think it is worth it to add a test case that hits it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
argType.IsPointer != paramType.IsPointer) | ||
jkotas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
return false; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always false