Skip to content

Commit

Permalink
Fix a potential overflow from large stacks
Browse files Browse the repository at this point in the history
This was hitting in the tests.  It only matters on platforms where long
is 32 bits, so had been missed before.
  • Loading branch information
jbytheway committed Oct 31, 2018
1 parent 3529460 commit 52696ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ units::volume item::volume( bool integral ) const
}

if( count_by_charges() || made_of( LIQUID ) ) {
auto num = ret * charges;
auto num = ret * static_cast<int64_t>( charges );
ret = num / type->stack_size;
if( num % type->stack_size != 0_ml ) {
ret += 1_ml;
Expand Down

0 comments on commit 52696ff

Please sign in to comment.