Skip to content

Commit

Permalink
Merge pull request #13689 from AdamKorcz/fuzz7
Browse files Browse the repository at this point in the history
server/storage/wal: fix oss-fuzz issue 44433
  • Loading branch information
spzala authored Feb 14, 2022
2 parents 830f00d + 0fcb2a6 commit aa75fd0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion server/storage/wal/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,12 @@ func visitEnumNumber(enum protoreflect.EnumDescriptor, number protoreflect.EnumN
if err != nil {
return err
}
return visitEnumValue(enum.Values().Get(int(number)), visitor)
intNumber := int(number)
fields := enum.Values()
if intNumber >= fields.Len() || intNumber < 0 {
return fmt.Errorf("could not visit EnumNumber [%d]", intNumber)
}
return visitEnumValue(fields.Get(intNumber), visitor)
}

func visitEnumValue(enum protoreflect.EnumValueDescriptor, visitor Visitor) error {
Expand Down

0 comments on commit aa75fd0

Please sign in to comment.