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

fix: prevent integer overflow in 32-bit binaries when configuring virtual disk #2200

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# <!-- markdownlint-disable first-line-h1 no-inline-html -->

## 2.8.2 (Not Released)

BUG FIX:

* `resource/virtual_machine`: Fixes overflow for the disk sub-resource when running a 32-bit version
of the provider .Modified the call to `GiBToByte` by passing the parameter as `int64` which forces the
function to go through the 64bit case.
([#2200](https://github.com/terraform-providers/terraform-provider-vsphere/pull/2200))

## 2.8.1 (May 08, 2024)

BUG FIX:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,7 @@ func (r *DiskSubresource) expandDiskSettings(disk *types.VirtualDisk) error {
if os.(int) > ns.(int) {
return fmt.Errorf("virtual disks cannot be shrunk")
}
disk.CapacityInBytes = structure.GiBToByte(ns.(int))
disk.CapacityInBytes = structure.GiBToByte(int64(ns.(int)))
disk.CapacityInKB = disk.CapacityInBytes / 1024
}

Expand Down