File tree 1 file changed +6
-1
lines changed
1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -341,8 +341,13 @@ int hdr_calculate_bucket_config(
341
341
sub_bucket_count_magnitude = (int32_t ) ceil (log ((double )largest_value_with_single_unit_resolution ) / log (2 ));
342
342
cfg -> sub_bucket_half_count_magnitude = ((sub_bucket_count_magnitude > 1 ) ? sub_bucket_count_magnitude : 1 ) - 1 ;
343
343
344
- cfg -> unit_magnitude = (int32_t ) floor (log ((double )lowest_trackable_value ) / log (2 ));
344
+ double unit_magnitude = log ((double )lowest_trackable_value ) / log (2 );
345
+ if (INT32_MAX < unit_magnitude )
346
+ {
347
+ return EINVAL ;
348
+ }
345
349
350
+ cfg -> unit_magnitude = (int32_t ) unit_magnitude ;
346
351
cfg -> sub_bucket_count = (int32_t ) pow (2 , (cfg -> sub_bucket_half_count_magnitude + 1 ));
347
352
cfg -> sub_bucket_half_count = cfg -> sub_bucket_count / 2 ;
348
353
cfg -> sub_bucket_mask = ((int64_t ) cfg -> sub_bucket_count - 1 ) << cfg -> unit_magnitude ;
You can’t perform that action at this time.
0 commit comments