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

[Issue-1368]: Panic in serializedPath.HasPrefix #1371

Merged
merged 11 commits into from
Apr 20, 2023
Prev Previous commit
Next Next commit
cleanup
  • Loading branch information
dboehm-avalabs committed Apr 18, 2023
commit 208c0b7ddde937e92b0302e320c62f4ce2d484d2
6 changes: 2 additions & 4 deletions x/merkledb/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ func (s SerializedPath) HasPrefix(prefix SerializedPath) bool {
return bytes.HasPrefix(s.Value, prefixValue)
}
reducedSize := len(prefixValue) - 1

// the input was invalid so just return false
if reducedSize < 0 ||
reducedSize >= len(prefixValue) ||
reducedSize >= len(s.Value) {
if reducedSize < 0 {
return false
}

Expand Down