Skip to content

Commit

Permalink
Fixed: ToIntVersion overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mynameisbogdan authored and Qstick committed Sep 2, 2024
1 parent dc8026c commit 32dd1d5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ServarrAPI/Datastore/Migration/002_break_up_version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ protected override void MainDbUpgrade()
// Create a sortable integer for version that can easily be compared against a max version,
// supports any major, minor to 99, patch to 99, builds up to 999,999.
Execute.Sql("UPDATE update SET intversion = " +
"((string_to_array(version, '.')::int[])[1] * 10000000000) + " +
"((string_to_array(version, '.')::int[])[2] * 100000000) + " +
"((string_to_array(version, '.')::int[])[3] * 1000000) + " +
"((string_to_array(version, '.')::int[])[1] * 10000000000L) + " +
"((string_to_array(version, '.')::int[])[2] * 100000000L) + " +
"((string_to_array(version, '.')::int[])[3] * 1000000L) + " +
"((string_to_array(version, '.')::int[])[4])");
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/ServarrAPI/Extensions/VersionExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public static class VersionExtensions
{
public static long ToIntVersion(this Version version)
{
return (version.Major * 10000000000) + (version.Minor * 100000000) + (version.Build * 1000000) + version.Revision;
return (version.Major * 10000000000L) + (version.Minor * 100000000L) + (version.Build * 1000000L) + version.Revision;
}
}
}

0 comments on commit 32dd1d5

Please sign in to comment.