This work is based on Wine-Staging patch "msi-msi_vcl_get_cost" by Mark Jansen.
That patch attempts to avoid overflow, although not particularly well, since the damage would already have been done by calculate_file_cost(). This patch series addresses the issue in both places.
The Wine-Staging patch seems to have originally been written in an attempt to address a bug visible with (at least) some Microsoft Office and LibreOffice installers where file costs would render incorrectly. That bug is recorded as ReactOS bug 12229 [1], which report includes both the patch to vcl_get_cost(), and the patch fixing the actual bug, which did eventually made it upstream as b53957df2a73ae51ca6ebc1e88bb9c4ed8b8d274.