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

SQL Server: remove unchecked casting of int to byte for Precision/Scale #30111

Closed
roji opened this issue Jan 22, 2023 · 0 comments · Fixed by #30164
Closed

SQL Server: remove unchecked casting of int to byte for Precision/Scale #30111

roji opened this issue Jan 22, 2023 · 0 comments · Fixed by #30164
Assignees
Labels
area-sqlserver area-type-mapping closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Milestone

Comments

@roji
Copy link
Member

roji commented Jan 22, 2023

In various places, we do an unchecked cast of precision/scale to byte when setting them on the SqlParameter (e.g. here). This could make an out-of-range value accidentally become in-range, yielding wrong results instead of an error. We should probably just do a checked cast, in which case the cast would fail for out-of-range values.

roji added a commit to roji/efcore that referenced this issue Jan 28, 2023
@roji roji changed the title SQL Server: review our unchecked casting of int to byte for Precision/Scale SQL Server: remove unchecked casting of int to byte for Precision/Scale Jan 28, 2023
@roji roji self-assigned this Jan 28, 2023
@roji roji added this to the 8.0.0 milestone Jan 28, 2023
roji added a commit to roji/efcore that referenced this issue Feb 4, 2023
@ghost ghost closed this as completed in #30164 Feb 4, 2023
ghost pushed a commit that referenced this issue Feb 4, 2023
@roji roji added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Feb 4, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0, 8.0.0-preview2 Feb 16, 2023
@ajcvickers ajcvickers modified the milestones: 8.0.0-preview2, 8.0.0 Nov 14, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-sqlserver area-type-mapping closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants