File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -1241,8 +1241,10 @@ impl<T: Counter> Histogram<T> {
1241
1241
1242
1242
#[ inline]
1243
1243
fn value_from_loc ( & self , bucket_index : u8 , sub_bucket_index : u32 ) -> u64 {
1244
- // sum won't overflow; bucket_index and unit_magnitude are both <= 64.
1245
- // However, the resulting shift may overflow if unit magnitude is large, for instance.
1244
+ // Sum won't overflow; bucket_index and unit_magnitude are both <= 64.
1245
+ // However, the resulting shift may overflow given bogus input, e.g. if unit magnitude is
1246
+ // large and the input sub_bucket_index is for an entry in the counts index that shouldn't
1247
+ // be used (because this calculation will overflow).
1246
1248
( sub_bucket_index as u64 ) << ( bucket_index + self . unit_magnitude )
1247
1249
}
1248
1250
You can’t perform that action at this time.
0 commit comments