Skip to content

Commit

Permalink
Prevent int64 to int truncation in Shard API usage.
Browse files Browse the repository at this point in the history
The function argument in `Shard` must be a function of two `int64` arguments. However, we are passing in a function with two `int` arguments. Thus, for large workloads, these arguments get truncated from positive `int64` values to negative `int` ones, resulting in a buffer out of bounds write.

PiperOrigin-RevId: 332557334
Change-Id: I236c9a2e7f53580e520571da8ba941a3aa9fa0b5
  • Loading branch information
mihaimaruseac authored and tensorflower-gardener committed Sep 19, 2020
1 parent 185df23 commit 27b4173
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tensorflow/core/kernels/random_op.cc
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ class RandomGammaOp : public OpKernel {
// avoid a couple flops which can be done on a per-alpha basis.

auto DoWork = [samples_per_alpha, num_alphas, &rng, samples_flat,
alpha_flat](int start_output, int limit_output) {
alpha_flat](int64 start_output, int64 limit_output) {
using Eigen::numext::exp;
using Eigen::numext::log;
using Eigen::numext::log1p;
Expand Down

0 comments on commit 27b4173

Please sign in to comment.