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

Potential overflow when store ActionTypes in schemaDiff #39656

Closed
Defined2014 opened this issue Dec 6, 2022 · 0 comments · Fixed by #39660
Closed

Potential overflow when store ActionTypes in schemaDiff #39656

Defined2014 opened this issue Dec 6, 2022 · 0 comments · Fixed by #39660
Assignees
Labels
type/enhancement The issue or PR belongs to an enhancement.

Comments

@Defined2014
Copy link
Contributor

Defined2014 commented Dec 6, 2022

Enhancement

tidb/domain/domain.go

Lines 345 to 355 in 1ddc592

}
if canSkipSchemaCheckerDDL(diff.Type) {
continue
}
phyTblIDs = append(phyTblIDs, IDs...)
for i := 0; i < len(IDs); i++ {
actions = append(actions, uint64(1<<diff.Type))
}
}
is := builder.Build()

See the code above, we used int64(1<<diff.Type) to store the ddl type before, but this will overflow when the ddl type is greater than 64 (now the biggest one is 67). IMO, we could store the type directly instead of left shift it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant