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: fix cast security issue #3243

Merged
merged 3 commits into from
Sep 29, 2024
Merged

fix: fix cast security issue #3243

merged 3 commits into from
Sep 29, 2024

Conversation

Yisaer
Copy link
Collaborator

@Yisaer Yisaer commented Sep 27, 2024

No description provided.

Signed-off-by: Song Gao <[email protected]>
@Yisaer Yisaer requested a review from ngjaying September 27, 2024 03:34
Signed-off-by: Song Gao <[email protected]>
Copy link

codecov bot commented Sep 27, 2024

Codecov Report

Attention: Patch coverage is 15.78947% with 32 lines in your changes missing coverage. Please review.

Project coverage is 70.74%. Comparing base (b898083) to head (3762f80).
Report is 11 commits behind head on master.

Files with missing lines Patch % Lines
pkg/cast/cast.go 0.00% 10 Missing and 5 partials ⚠️
...rnal/converter/protobuf/fieldConverterSingleton.go 0.00% 8 Missing and 4 partials ⚠️
pkg/tracer/manager.go 60.00% 2 Missing ⚠️
pkg/tracer/tracer.go 0.00% 2 Missing ⚠️
internal/server/tracer.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3243      +/-   ##
==========================================
- Coverage   70.85%   70.74%   -0.11%     
==========================================
  Files         395      395              
  Lines       44335    44424      +89     
==========================================
+ Hits        31411    31427      +16     
- Misses      10430    10488      +58     
- Partials     2494     2509      +15     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -122,6 +126,9 @@ func (fc *FieldConverter) EncodeField(field *desc.FieldDescriptor, v interface{}
if err != nil {
return 0, nil
} else {
if r > math.MaxUint32 {
return 0, fmt.Errorf("value %d is out of uint32 range", v)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same as above

@@ -174,6 +181,9 @@ func (fc *FieldConverter) encodeSingleField(field *desc.FieldDescriptor, v inter
case dpb.FieldDescriptorProto_TYPE_INT32, dpb.FieldDescriptorProto_TYPE_SFIXED32, dpb.FieldDescriptorProto_TYPE_SINT32, dpb.FieldDescriptorProto_TYPE_ENUM:
r, err := cast.ToInt(v, cast.CONVERT_SAMEKIND)
if err == nil {
if r > math.MaxInt32 {
return 0, fmt.Errorf("value %d is out of int32 range", v)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same as above

@@ -188,6 +198,9 @@ func (fc *FieldConverter) encodeSingleField(field *desc.FieldDescriptor, v inter
case dpb.FieldDescriptorProto_TYPE_FIXED32, dpb.FieldDescriptorProto_TYPE_UINT32:
r, err := cast.ToUint64(v, cast.CONVERT_SAMEKIND)
if err == nil {
if r > math.MaxUint32 {
return 0, fmt.Errorf("value %d is out of uint32 range", v)
Copy link
Collaborator

Choose a reason for hiding this comment

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

The same as above

Signed-off-by: Song Gao <[email protected]>
@ngjaying ngjaying merged commit 58c15a6 into lf-edge:master Sep 29, 2024
53 of 56 checks passed
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.

2 participants